Home >Database >Mysql Tutorial >Detailed explanation of the solution to the 'Unknown column 'password' prompt when MySQL resets the root password
This article mainly introduces the solution to MySQLresetting the root password prompt "Unknown column 'password". It is very good and has reference value. Friends who need it can refer to it
I turned on my MAC at night and found that the root account suddenly could not log in to MySQL normally, so I planned to reset the password. I read a few articles, but the reset failed. I always got the error of Unknown column 'password'. I also looked at the table structure of user. This field does not exist anymore. After investigation, it was found that the field name was changed after MySQL was upgraded, and the password name was changed to authentication_string. After knowing the reason, you can successfully reset the root password by following the following command.
$sudo mysql.server stop #先关闭正常的MySQL服务 $sudo mysqld_safe --skip-grant-tables #跳过MySQL认证 $sudo mysql -uroot -p #提示密码时,直按按ENTER就能进入mysql命令行 mysql>use mysql; mysql>update user set authentication_string=password('newpassword') where user=‘root'; mysql>exit; $sudo mysql.server start #再次启动MySQL服务,就可以使用新密码正常登陆了
The MySQL version for Mac is:
mysql Ver 14.14 Distrib 5.7.10, for osx10.11 (x86_64) using EditLine wrapper
The above is the detailed content of Detailed explanation of the solution to the 'Unknown column 'password' prompt when MySQL resets the root password. For more information, please follow other related articles on the PHP Chinese website!