创建数据库

1
CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;

创建用户

1
create user 'user'@'%' identified by '123';

授权用户

1
grant all privileges on db.* to 'user'@'%';

查看用户

1
show grants for 'user'@'%';   

修改密码

1
2
3
use mysql; 
update user set password=password('123') where user='root' and host='localhost';
flush privileges;

mysql8密码问题

1
ALTER USER 'native'@'%' IDENTIFIED WITH mysql_native_password BY 'new_password';

mysql8导出数据权限

1
grant process on *.* to dumper;