mysql 授权
进入 mysql:mysql --sock=/usr/local/mysql/mysql.sock -uroot -p123456
对mysql用户设置远程访问权限
方法1、改表法:登陆mysql后,更改“mysql”数据库里的“user”表里的“host”项,将“localhost”改“%”
mysql>use mysql;
mysql>update user set host ='%' where user ='root';
mysql>select host,user from user;
mysql>FLUSH PRIVILEGES
mysql>update user set host ='%' where user ='root';
mysql>select host,user from user;
mysql>FLUSH PRIVILEGES
使用以下授权语句,将授权指定的192.168.1.1 的机器,使用用户名为root,密码为root的用户访问
grant all privileges on *.* to 'root'@'192.168.1.1' identified by 'root';
grant all privileges on *.* to identified by 'root';
flush privileges 即可;