MySQL Reset root Password Hint 'Unknown column' password 'Solution

  • 2021-07-03 00:57:01
  • OfStack

When I opened MAC at night, I found that the root account suddenly could not log in to MySQL normally, so I planned to reset my password. After reading several articles, the reset was unsuccessful, and I always got the error of Unknown column 'password. After reading the table structure of user, there was really no such field. After investigation, it was found that the field name was changed after MySQL was upgraded, and the name of password 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 # Turn off the normal one first MySQL Services 
$sudo mysqld_safe --skip-grant-tables # Skip MySQL Certification 
$sudo mysql -uroot -p # When prompted for password, press directly ENTER You can enter mysql Command line 
mysql>use mysql;
mysql>update user set authentication_string=password('newpassword') where user= ' root';
mysql>exit;
$sudo mysql.server start # Start again MySQL Service, you can log in normally with your new password 

The MySQL version of Mac is:

mysql Ver 14.14 Distrib 5.7.10, for osx10.11 (x86_64) using EditLine wrapper


Related articles: