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;