-
使用“Ctrl + R”组合键快速打开cmd窗口,并输入“cmd”命令,打开cmd窗口。
-
使用“mysql -uroot -proot”命令可以连接到本地的mysql服务。
-
使用“use mysql”命令,选择要使用的数据库,修改远程连接的基本信息,保存在mysql数据库中,因此使用mysql数据库。
-
使用“GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘root’ WITH GRANT OPTION;”命令可以更改远程连接的设置。
-
具体制定IP可连接见9.
-
使用“flush privileges;”命令刷新刚才修改的权限,使其生效。
-
使用“select host,user from user;”查看修改是否成功。
-
本文转载自:http://www.cnblogs.com/fnlingnzb-learner/p/5848405.html
-
mysql的赋权操作:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
- GRANT:赋权命令
ALL PRIVILEGES:当前用户的所有权限
ON:介词
*.*:当前用户对所有数据库和表的相应操作权限
TO:介词
‘root’@’%’:权限赋给root用户,所有ip都能连接
IDENTIFIED BY ‘123456’:连接时输入密码,密码为123456
WITH GRANT OPTION:允许级联赋权 - 查看MySQL的端口:show global variables like 'port';