-- mysql8部署执行语句
-- 修改数据库密码认证方式(不修改密码则不执行)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
-- root用户设置为可远程连接(注意:需要在mysql数据库下执行)
update user set host='%' where user='root';
-- 给用户授权
grant all privileges on *.* to 'root'@'%' with grant option
-- 创建角色
create role 'role_all'
-- 给角色授权
grant all privileges on *.* to role_all;
-- 给用户添加角色
grant role_all to 'root'@'%';
-- 刷新权限
flush privileges;
mysql8 授权
最新推荐文章于 2025-06-26 19:02:04 发布