1, add skip-grant-tables at the end of/ETC/MY.CNF, save, skip authentication.
2. Restart MySQL to make the configuration you just modified take effect.
3, terminal input MySQL, and then enter use MySQL;
4, terminal input Update mysql.user set Authentication_string=password (' 123456 ') where user= ' root ';
5, remove skip-grant-tables at the end of/etc/my.cnf, save.
6, restart MySQL, terminal input mysql-u root-p, and then follow the prompts to enter the password just set to normal use.
Description: The reason to change the password is because of an error in Access denied for user ' root ' @ ' localhost ', changing the password by password-free login, entering update mysql.user set Password=password (' 123456 ') where user= ' root ' When prompted Unknown column ' Password ' in ' Field List ', originally there is no password this field under the MySQL database, The password field is changed to authentication_string.
Install MySQL database on Linux server (default installation, password is blank), need to change password for first use