Mysql Intro - Change Root Password
1. clean previous mysql
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
2. for mysql 5.7 or above
The following command is ok
mysql -u root -p
But the following command is not ok.
mysql -u root -p 'rootpassword'
3. mysql change root password
|
264down voteaccepted
|
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 |
||||||||||||||||||||
|
|
One pitfall I fell into is there is no password field now, it has been renamed so:
Should now be:
|
|||||||||
|
|
Use the https://dev.mysql.com/doc/refman/5.7/en/alter-user.html For example.
|
|||||||||||||||||
|
|
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
|
|||
|
|
|
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:
For MySQL version 5.7 and up
|
||||
|
|
|
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 If it doesnt works then add the string 2) Run
then Before |
||||
|
|
|
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. |
posted on 2017-09-26 17:15 fanbird2008 阅读(248) 评论(0) 收藏 举报

浙公网安备 33010602011771号