1、进入docker下mysql
docker exec -it 容器ID /bin/bash
mysql -uroot -p
2、修改用户密码
UPDATE user SET password = PASSWORD('newpassword') where USER='root'; // password ==> authentication_string
flush privileges;
3、创建新用户
CREATE USER ‘test’@’%’ IDENTIFIED BY ‘123456’;
或者
insert into user(host,user,authentication_string) values('%','test',password('123456'));
4、授权
grant all on *.* to 'test'@'%' identified by '123456' with grant option; // 授所有权限
flush privileges;
SHOW GRANTS FOR 'test'@'%'; // 查看授权
revoke all on user.* from 'test'@'%';
5、删除用户
delete from user where user=’test’ and host=’%’;
标签:password,创建,用户,user,mysql,test,123456,centos8 From: https://www.cnblogs.com/bk-your/p/16881392.html