Change the Mysql root Password from null to 123456 and root123456
After using mysqladminmysqladmin-u root-p password mypasswd to enter this command, enter the original root password (empty) and change the root password to mypasswd.
[Work @ master bin] $ mysqladmin-u root password 123456
[Work @ master bin] $
After the above command is executed, the second action is blank, which indicates that your password has been updated successfully.
The root password is set to 123456.
How can I change the root password of mysql?
Step 1: log on to MYSQL
Mysql-u root-p
Then press enter to enter (equivalent to entering with a blank password)
Step 2:
Use mysql;
Update user set password = password ('new password') where user = 'root ';
In this step, the password is updated.
Step 3:
Flush privileges;
Refresh permission.
OK. modified.
Password problem in linux: I have changed the root password 123456. you can log on again and enter 123456 again. The MYSQL password error is returned:
1. update the password should be a hash value.
MySQL> update user set password = password ('000000') where user = 'root ';
2. set to modify the mysql Hash Password
MySQL> set password for 'root' @ 'localhost' = PASSWORD ('123 ');
3. Run the mysqladmin command to change the password.
Shell> mysqladmin-uroot-poldpassword password 123456;
4. Set the password when using grant or create user
MySQL> grant all privileges on db01. * to user01 @ "localhost" Identified by "newpassword ";
MySQL> create user 'newuser' @ 'localhost' identified by 'newpass ';