1、打开mysql,输入密码
2、输入:use mysql;
3、查询host输入: select user,host from user;
4、授权用户
(1)任意主机以用户root和密码pwd连接到mysql服务器
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘pwd‘ WITH GRANT OPTION;
mysql> flush privileges;
(2)指定IP为(如192.168.0.160)的主机以用户tuser和密码tpwd连接到mysql服务器
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.0.160‘ IDENTIFIED BY ‘pwd‘ WITH GRANT OPTION;
mysql> flush privileges;
第一个*表示库名第二个*表示表名
时间: 2024-10-28 05:04:29