安装完MySQL后初次登录
注意:此时user为root,password为空的;
用命令:sudo mysql -u root -p 登录,提示输入数据库密码时,直接enter即可。
改密码步骤:
-
use mysql;
-
update user set plugin="mysql_native_password",authentication_string=password('新密码') where user="root";
- FLUSH PRIVILEGES; (刷新权限)
安装完MySQL后初次登录
注意:此时user为root,password为空的;
用命令:sudo mysql -u root -p 登录,提示输入数据库密码时,直接enter即可。
改密码步骤:
use mysql;
update user set plugin="mysql_native_password",authentication_string=password('新密码') where user="root";