时间:2021-07-01 10:21:17 帮助过:3人阅读
拿test作为示例:
1 # 进入mysql 2 mysql -u root -p 3 # 本地访问账户 4 CREATE USER ‘test‘@‘localhost‘ IDENTIFIED BY ‘ln122920‘; 5 # 远程访问 6 CREATE USER ‘test‘@‘%‘ IDENTIFIED BY ‘ln122920‘; 7 # 本地全部授权,授权test用户拥有testDB
数据库的所有权限 8 grant all privileges on testDB.* to ‘test‘@‘localhost‘ identified by ‘ln122920‘; 9 # 远程全部授权,授权test用户拥有testDB
数据库的所有权限 10 grant all privileges on testDB.* to ‘test‘@‘%‘ identified by ‘ln122920‘; 11 # 刷新权限 12 flush privileges;
如果你只需要部分权限,则:
grant select,update on testDB.* to ‘test‘@‘localhost‘ identified by ‘ln122920‘; flush privileges; # 刷新权限
最后重启一下:service mysql restart
mysql5.7新增加用户和授权
标签:bsp round for col 测试 权限 art localhost 设置