点击mysql 或者在命令行 use mysql
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
备注1:%替换为可访问数据库的ip,例如“127.0.0.1”“192.168.1.1”,使用“%”表示不限制远程连接ip
备注2:username可修改:为登录的用户名;password可修改:为登录的密码
SELECT * FROM user;
GRANT select ON xl_game3.* TO 'username'@'%';
备注:select 可用其他的来替换
FLUSH PRIVILEGES;
ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY '123456' ;
DROP user 'username'@'%' ;
SHOW GRANTS FOR 'username'@'%'
GRANT insert ON xl_game3.* TO 'username'@'%';
再次查询 SHOW GRANTS FOR 'username'@'%'
REVOKE ?INSERT ON xl_game3.* FROM 'username'@'%'
再次查询 SHOW GRANTS FOR 'username'@'%'