Solution: 1. Use the "grep 'temporary password' /var/log/mysqld.log" command to retrieve the initial password during installation; 2. Modify the configuration file "my.cnf" to avoid Log in to the mysql server with your password and use the update command to set a new password.
The operating environment of this tutorial: CentOS 6 system, mysql8 version, Dell G3 computer.
Solution to the forgotten mysql default password under centos
Method 1. Retrieve the initial password during installation:
Execute the following command directly
grep 'temporary password' /var/log/mysqld.log
##Method 2. Configure the my.cnf file, log in to the mysql server without a password, and use the update command Set a new password
#vim /etc/my.cnf(Note: windows The modification below is my.ini)
explicit_defaults_for_timestamp=true skip-grant-tables
service mysqld restart
mysql -uroot
use mysql update user set authentication_string=password(“123456”) where user=“root”;
mysql video tutorial)
The above is the detailed content of What should I do if I forget mysql default password under centos?. For more information, please follow other related articles on the PHP Chinese website!