添加用户
1.允许本地访问的用户(127.0.0.1)
create user zhrt@localhost identified by '123456';
2.允许外网IP访问的用户
create user 'zhrt'@'%' identified by '123456';
用户分配权限
授予用户在本地服务器对该数据库的全部权限
grant all privileges on dbname.* to zhrt@localhost identified by '123456';
授予用户通过外网IP对于该数据库的全部权限
grant all privileges on dbname.* to 'zhrt'@'%' identified by '123456';
刷新权限
flush privileges;
网友评论