In some way I have managed to get this error when I try to access into MySQL via the command line:
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I have tried resetting the password without any luck using this HowTo.
I have uninstalled mysql completley and reinstalled but I still get asked for a password. I have no idea why this is the case!
Can someone please help me get a default install of MySQL.
Fedora Core 10, Full Root Access, Apache and PHP installed
Thank you for any help!!
To all those that would like to save themselves a few hours of "blood coughing" - when you uninstall MySQl completely delete everything that is left behind. If you don't do this, it will never be a FRESH install.
This question is related to
mysql
linux
passwords
mysql-error-1045
I could not connect to MySql Administrator. I fixed it by creating another user and assigning all the permissions.
I logged in with that new user and it worked.
Try connecting without any password:
mysql -u root
I believe the initial default is no password for the root account (which should obviously be changed as soon as possible).
The current root password must be empty. Then under "new root password" enter your password and confirm.
use this command to check the possible output
mysql> select user,host,password from mysql.user;
output
mysql> select user,host,password from mysql.user;
+-------+-----------------------+-------------------------------------------+
| user | host | password |
+-------+-----------------------+-------------------------------------------+
| root | localhost | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | localhost.localdomain | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | 127.0.0.1 | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| admin | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| admin | % | |
+-------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
Grant the user admin with password using GRANT command once again
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED by 'password'
then check the GRANT LIST the out put will be like his
mysql> select user,host,password from mysql.user;
+-------+-----------------------+-------------------------------------------+
| user | host | password |
+-------+-----------------------+-------------------------------------------+
| root | localhost | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | localhost.localdomain | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | 127.0.0.1 | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| admin | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| admin | % | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+-------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
if the desired user for example user 'admin' is need to be allowed login then use once GRANT command and execute the command.
Now the user should be allowed to login.
I had the same error, but it was because password_expired
was set to Y
. You can fix that issue by following the same approach as the currently accepted answer, but instead executing the MySQL query:
UPDATE mysql.user SET password_expired = 'N' WHERE User='root';
Try connecting without any password:
mysql -u root
I believe the initial default is no password for the root account (which should obviously be changed as soon as possible).
Try connecting without any password:
mysql -u root
I believe the initial default is no password for the root account (which should obviously be changed as soon as possible).
use this command to check the possible output
mysql> select user,host,password from mysql.user;
output
mysql> select user,host,password from mysql.user;
+-------+-----------------------+-------------------------------------------+
| user | host | password |
+-------+-----------------------+-------------------------------------------+
| root | localhost | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | localhost.localdomain | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | 127.0.0.1 | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| admin | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| admin | % | |
+-------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
Grant the user admin with password using GRANT command once again
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED by 'password'
then check the GRANT LIST the out put will be like his
mysql> select user,host,password from mysql.user;
+-------+-----------------------+-------------------------------------------+
| user | host | password |
+-------+-----------------------+-------------------------------------------+
| root | localhost | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | localhost.localdomain | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| root | 127.0.0.1 | *8232A1298A49F710DBEE0B330C42EEC825D4190A |
| admin | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| admin | % | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+-------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
if the desired user for example user 'admin' is need to be allowed login then use once GRANT command and execute the command.
Now the user should be allowed to login.
I could not connect to MySql Administrator. I fixed it by creating another user and assigning all the permissions.
I logged in with that new user and it worked.
Try connecting without any password:
mysql -u root
I believe the initial default is no password for the root account (which should obviously be changed as soon as possible).
I had the same error, but it was because password_expired
was set to Y
. You can fix that issue by following the same approach as the currently accepted answer, but instead executing the MySQL query:
UPDATE mysql.user SET password_expired = 'N' WHERE User='root';
Source: Stackoverflow.com