1.登录
mysql -uroot -p
2.执行命令
切换数据库
mysql> use mysql;
查询表
查询host
mysql> select user,host from user;
创建host
4.创建host
如果没有"%"这个host值,就执行下面这两句:
mysql> update user set host='%' where user='root';
mysql> flush privileges;
授权
5.授权用户
任意主机以用户root和密码mypwd连接到mysql服务器
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
mysql> flush privileges;