When I use mysqld_safe to start my MySQL in CentOS7:
[root@localhost bin]# mysqld_safe --skip-grant-tables &
[1] 32586
[root@localhost bin]# 2017-09-07T13:29:36.423040Z mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
2017-09-07T13:29:36.456574Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
It get stuck in the mysqld_safe Starting mysqld daemon.
I find the SO, do not find this post, and some similar, but is not stuck, they report error directly.
MySQL version is 5.7.19
My requirement is change the user root's password.
At last, I find if change the mysql version greater than 5.7's password, we should not use the outdated method.
The correct method:
In the mysql config file /etc/my.cnf, add skip-grant-tables in the [mysqld].
Restart mysql (/etc/init.d/mysqld restart)
Start mysql (type mysql directly)
Change the password of user(root)
ALTER USER 'root'@'localhost'IDENTIFIED BY 'newpassword'
Exit mysql and delete the skip-grant-tables in /etc/my.cnf
Then you can use mysql -u root -p to login the mysql now.
To change the root's password, you can run mysql_secure_installation
https://mariadb.com/kb/en/library/mysql_secure_installation/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With