I am trying to change MySql root password.
What I have done is below.
- Install MySql-5.7.6 ~ .dmg(Community Server) and workbench.
- Turn off the server on OSX System preferences.
- Access MySql with console. The command was
mysqld_safe --skip-grant
- Execute
update user set password=password('1111') where user='root';
and got an error message -->ERROR 1054 (42S22): Unknown column 'password' in 'field list'
.
FYI, I did use mysql;
.
So I did select query on user table and found password column actually does not exist.
It is very weird. Is it possible that original user table does not have password column?
How can I change password, which does not exist?
Thanks for your answer :D
In MySQL 5.7, the password field in mysql.user table field was removed, now the field name is 'authentication_string'.
First choose the database:
And then show the tables:
You will find the user table, now let's see its fields:
Surprise!There is no field named 'password', the password field is named ' authentication_string'. So, just do this:
Now, everything will be ok.
Compared to MySQL 5.6, the changes are quite extensive: What’s New in MySQL 5.7
Thank you for your help. Just in case if people are still having problems, try this.
For MySQL version 5.6 and under
Have you forgotten your Mac OS X 'ROOT' password and need to reset it? Follow these 4 simple steps:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
sudo /usr/local/mysql/bin/mysql -u root UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root'; FLUSH PRIVILEGES; \q
For MySQL version 5.7 and up
'System Prefrences' > MySQL > 'Stop MySQL Server'
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
sudo /usr/local/mysql/bin/mysql -u root UPDATE mysql.user SET authentication_string=PASSWORD('NewPassword') WHERE User='root'; FLUSH PRIVILEGES; \q
remember password needs to be set further even after restarting mysql as below
It only worked with me when I "flushed" after the commands mentioned here. Here's the full list of commands I used:
Previous answers might not work for later mysql versions. Try these steps if previous answers did not work for you:
1- Click on the wamp icon > mysql > mysql console
2- write following commands, one by one
For this problem, I used a simple and rude method, rename the field name to password, the reason for this is that I use the mac navicat premium software in the visual operation error: Unknown column 'password' in 'field List ', the software itself uses password so that I can not easily operate. Therefore, I root into the database command line, run
And then modify the field name:
After all normal.
This error happens if you did not set the password on install, in this case the mysql using unix-socket plugin.
But if delete the plugin link from settings (table mysql.user) will other problem. This does not fix the problem and creates another problem. To fix the deleted link and set password ("PWD") do:
1) Run with
--skip-grant-tables
as said above.If it doesnt works then add the string
skip-grant-tables
in section[mysqld]
of/etc/mysql/mysql.conf.d/mysqld.cnf
. Then dosudo service mysql restart
.2) Run
mysql -u root -p
, then (change "PWD"):then
sudo service mysql restart
. Check:mysql -u root -p
.Before
restart
remove that string from file mysqld.cnf, if you set it there.