(Windows)Mysql设置远程连接,授权

来源:互联网 发布:王者荣耀 刘备 知乎 编辑:程序博客网 时间:2024/06/05 11:00
一、连接mysql
cd mysql bin目录下:
cd C:\Program Files\MySQL\MySQL Server 5.5\bin
连接mysql:
mysql -hlocalhost -uroot -p
输入密码
Enter password:xxx
二、授权远程连接
从任何主机使用用户名/密码 root/123456连接到mysql服务器。(所有ip可连接
mysql>grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
只能从10.10.50.127的主机指定用户/密码 root/123456连接到mysql服务器(指定ip可连接
mysql>grant all privileges on *.* to 'jack'@'10.10.50.127' identified by '654321' with grant option;
使配置生效
mysql>flush privileges;