Change Password:
Method 1: Use the Set password command
Mysql-u Root
mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');
Method 2: Use Mysqladmin
mysqladmin-u root Password "Newpass"
If Root has already set a password, use the following method
mysqladmin-u root password Oldpass "Newpass"
Method 3: Edit the user table directly with update
Mysql-u Root
mysql> use MySQL;
mysql> UPDATE user SET Password = Password (' newpass ') WHERE user = ' root ';
mysql> FLUSH privileges;
This can be done when the root password is lost
Mysqld_safe--skip-grant-tables&
Mysql-u Root MySQL
mysql> UPDATE user SET Password=password ("New password") WHERE user= ' root ';
mysql> FLUSH privileges;
Set up IP access
Mysql>use MySQL;
Mysql>select ' host ', ' user ' from user where user= ' root ';
Mysql>update User Set host = '% ' where user = ' root ' and host= ':: 1 ';
Mysql>flush privileges;
Mysql>quit
MySQL change root password, set IP access