Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

mysql

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.

like image 826
aircraft Avatar asked Dec 31 '25 15:12

aircraft


2 Answers

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.

like image 96
aircraft Avatar answered Jan 03 '26 07:01

aircraft


To change the root's password, you can run mysql_secure_installation https://mariadb.com/kb/en/library/mysql_secure_installation/

like image 38
Matthew Avatar answered Jan 03 '26 06:01

Matthew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!