新增用户
1 2 3 4 5
| create user [用户名] identified by '[密码]';
grant all privileges on [数据库].* to [用户名]@'%' identified by '[密码]'; flush privileges;
|
开启远程登录权限
1 2 3 4
| GRANT ALL PRIVILEGES ON *.* TO '[用户名]'@'%' IDENTIFIED BY '[密码]' WITH GRANT OPTION;
FLUSH PRIVILEGES;
|
修改密码
可能会报异常
1819 - Your password does not satisfy the current policy requirements
1 2 3 4 5
| set global validate_password_policy=0;
set global validate_password_length=1; SHOW VARIABLES LIKE 'validate_password%';
|
修改密码
1 2 3
| mysql> update mysql.user set authentication_string=password('root') where user='root'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 1
|
初始化设置密码
You must reset your password using ALTER USER statement before executing this statement
1
| set password = password('root');
|