MySQL: Error 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)

1. $ mysql -u root
2. Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Maybe updating the package the updater overwrote the root password.
To restore it:
  • Stop mysqld deamons.
1.
 $ sudo service mysql stop
  • Go  to  mysql/bin directory

1.
 $ cd /usr/bin
  • Start a mysql deamon with this option:

1
. $ sudo mysqld_safe --skip-grant-tables
  • Open another terminal and open a mysql session to execute this:



    1. $ mysql
    2. mysql> use mysql;
    3. mysql> UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD_HERE') WHERE user = 'root';
    4. mysql> exit;
     Now kill the mysqld_safe process and restart mysqld normally:

    $ sudo service mysql start
SHARE

About Lasha Gogua

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment