Skip to content
Advertisement

get stuck in mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

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.

Advertisement

Answer

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:

  1. In the mysql config file /etc/my.cnf, add skip-grant-tables in the [mysqld].

  2. Restart mysql (/etc/init.d/mysqld restart)

  3. Start mysql (type mysql directly)

  4. Change the password of user(root)

    ALTER USER 'root'@'localhost'IDENTIFIED BY 'newpassword'
    
  5. Exit mysql and delete the skip-grant-tables in /etc/my.cnf

  6. Then you can use mysql -u root -p to login the mysql now.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement