MySQL 5.7.7 - Access denied
You get the 'Access denied' message while login into mysql server after successful installation of MySQL 5.7.X on Centos 7/RHEL.
Here is the solution.
Note: before trying following instruction please do not start mysql service otherwise steps will not work.
-
MySQL 5.7.X or higher generates a temporary random password.
-
Fire the blow command from console or refer URL https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
-
shell> bin/mysqld --initialize --user=mysql
-
shell> bin/mysqld --initialize-insecure --user=mysql
-
Password is stored in mysql error log file, located at /var/log/mysqld.log
-
use below command to see the password:
-
shell > sudo grep 'temporary password' /var/log/mysqld.log
-
you will get password like '/vHb/aao-6sX'
-
Try to login with above output password.
-
And change password using below command
-
ALTER USER 'root'@'localhost' IDENTIFIED BY '#*Admin123456';
-
Query OK, 0 rows affected (0.01 sec)
-
Password strength should be good enough otherwise system will not accept it.
-
Now you can start mysql server using below command
-
shell > sudo systemctl start mysqld.service
Comments
Post a Comment