# 默认用户登陆之后并没有实际操作的权限 # 需要使用管理员root用户登陆 $ mysql -uroot -p # mysql5.6默认是没有密码的 #遇到password直接按回车键 mysql> set password = password('123'); # 给当前数据库设置密码
# 创建账号 mysql> create user 'aaron'@'192.168.10.%' IDENTIFIED BY '123';# 指示网段 mysql> create user 'aaron'@'192.168.10.5' # 指示某机器可以连接 mysql> create user 'aaron'@'%' #指示所有机器都可以连接 mysql> show grants for 'aaron'@'192.168.10.5';查看某个用户的权限 # 远程登陆 $ mysql -uroot -p123 -h 192.168.10.3
# 给账号授权 mysql> grant all on *.* to 'aaron'@'%'; mysql> flush privileges; # 刷新使授权立即生效
# 创建账号并授权 mysql> grant all on *.* to 'aaron'@'%' identified by '123'