Change Password
1. Newly Installed database setup password
Mysqladmin-u Root Password 123456
2. If your root now has a password (123456), then the command to change the password to ABCdef is:
Mysqladmin-u root-p Password abcdef
Note that the command will ask you the old password, enter the old password 123456 after the command completes, the password modification succeeds.
Or
Mysqladmin-u root-p123456 Password www123
MYSQL Forgot Password Solution
Method One:
If MySQL is running, first kill it: Pkill MySQL
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can go to MySQL without a password.
Enter Mysql-uroot-p return Enter
Then there is
>use MySQL
>update User Set Password=password ("New_pass") where user= "root";
>flush privileges;
> Quit quitting
Service mysqld Restart
Mysql-uroot-p New Password entry
Method Two:
1. Edit the MySQL Master profile my.cnf
Vim/etc/my.cnf
Add a parameter under the [Mysqld] field skip-grant
2. Restart the database service
Service mysqld Restart
3. This allows access to the database without authorization.
Mysql-uroot
4. Modify the corresponding user password
Use MySQL;
Update user set Password=password (' Your password ') where user= ' root ';
Flush privileges;
5. Modify/ETC/MY.CNF remove skip-grant, restart MySQL service
This article is from the "Bill of Operations Notes" blog, please be sure to keep this source http://chenshoubiao.blog.51cto.com/6159058/1842629
MySQL forgot root password workaround