mysql 添加用户并给用户赋予不同的权限


mysql添加用户,并给用户设置权限:

1.本地访问用户:
create user 'front'@'localhost' identified by '123456';

2.允许外网 IP 访问
create user 'front'@'%' identified by '123456';

3.授予用户通过外网IP对于该数据库的全部权限
grant all privileges on `testdb`.* to 'front'@'%' identified by '123456';

4.授予用户在本地服务器对该数据库的全部权限
grant all privileges on `testdb`.* to 'front'@'localhost' identified by '123456';

5.授予该用户通过外网IP对该服务器上所有数据库的全部权限
grant all privileges on *.* to 'front'@'%' identified by '123456';

6.授予用户在本地服务器对该服务器上所有数据库的全部权限
grant all privileges on *.* to 'front'@'localhost' identified by '123456';

7.刷新权限
flush privileges;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM