登录MySQL
登录本地用户命令:
mysql -uroot -p
输入用户密码
这种情况就是登陆进来了
先来瞅一下我们有哪些用户:
查看用户命令:
select user,host,password from mysql.user;
先来整一个用户添加进去
CREATE USER '用户名'@'host' IDENTIFIED BY '密码';
用户分配权限
授予用户在本地服务器对该数据库的全部权限
grant all privileges on dbname.* to '用户名'@localhost identified by '密码';
授予用户通过外网IP对于该数据库的全部权限
grant all privileges on dbname.* to '用户名'@'%' identified by '密码';
刷新权限,不刷新不生效
flush privileges;