-
Change password (old version):
mysql -u root -p Enter password:*** mysql>use mysql; --选择数据库-- Database changed mysql> UPDATE user SET password=PASSWORD("新密码") WHERE user='你的用户名'; mysql> FLUSH PRIVILEGES; mysql> quit;
-
When newly installed MySQL5.7, prompts password error, the installation does not change the password, then change the password-free login password, the input
update mysql.user set password=password('root') where user='root';
prompt
ERROR 1054 (42S22): Unknown column 'password' in 'field list',
The original is a mysql database has no password this field of, password field into a authentication_string
-
So change the sentence is replaced
update mysql.user set authentication_string=password('root') where user='root';
-
Change Username:
mysql -u root -p Enter password:*** mysql> use mysql; --选择数据库-- Database changed mysql> update user set user="新用户名" where user="root"; --将用户名为root的改为新用户名-- mysql> flush privileges; --刷新权限-- mysql> exit