Access denied for user ‘root’@’localhost’ (using password: NO) – what’s wrong?

Change the file my.cnf (in my Ubuntu-system he is placed at /etc/mysql/my.cnf). In the end add this code:

[mysqld]
skip-grant-tables

That’s helps enter in condole as anyone user without pass. Restart the server: sudo service mysql restart

Enter in the mysql-console:

mysql -u root

Change the password for user root:

UPDATE mysql.user SET authentication_string=PASSWORD('root'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';FLUSH PRIVILEGES;

exit the console:

\q

Remove (or use commentary) for that in my.cnf (we dont need that settings now):

#[mysqld]
#skip-grant-tables

restart mysql-server:

sudo service mysql restart

Leave a comment

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