Solved “(ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)”

During the installation and configuration mysql on linux machine if you encounter this error so this idea may help to resolve “Access denied for user ‘root’@’localhost’.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

$ sudo service mysql stop

create mysql service directory

$ sudo mkdir /var/run/mysqld

Provide MySQL permission to work with the created directory.

$ sudo chown mysql: /var/run/mysqld

Start MySQL service without permission and network checking.

sudo mysqld_safe --skip-grant-tables --skip-networking &

Now try to log in your server without any password.

$ mysql -u root mysql
           
          or

$ sudo mysql -u root mysql 



Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *