itlaoli

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;

 

posted @ 2018-03-06 15:26  竹--石  阅读(3481)  评论(0编辑  收藏  举报