Change the mysql password in linux
(Debian system)
1. serviceMySQLstop
2. mysqld_safe -- skip-grant-tables
3. Open another console and continue the following steps
4. log on to mysql-u root with a blank password
5. show databases;
6. use mysql;
7. update user set Password = password ('ts123456') where user = 'root ';
8. flush privileges;
9. quit;
A. mysql-u root-p
B. 123456
(CentOS System)
Service mysql stop
Mysqld_safe -- skip-grant-tables &
Mysql-u root-p
Use a blank password to log on
Use mysql;
Update user set authentication_string = Password ('ts123456') where user = 'root ';
Flush privileges;
Set password = PASSWORD ('20140901 ');
Alter user 'root' @ 'localhost' password expire never;
Flush privileges;
This can also solve the following problems:
ERROR 1820 (HY000): You must reset your password using alter user statement before executing this statement.
Mysql local Login
Mysql-u root-p
123456
Mysql Remote Login
Mysql-h 192.168.2.100-u root-p
123456
Enable remote access for mysql
Grant all privileges on *. * to 'root' @ '%' identified by '000000' with grant option;