标签:option 使用 自定义 方法 use 进入 管理 其他 inpu
在搭建完LNMP环境后用Navicate/mysql Workbench连接出错
遇到这个问题首先到mysql所在的服务器上用连接进行处理
1、连接服务器: mysql -u root -p
2、看当前所有数据库:show databases;
3、进入mysql数据库:use mysql;
4、查看mysql数据库中所有的表:show tables;
5、查看user表中的数据:select Host, User,Password from user;
6、修改user表中的Host:update user set Host=‘%‘ where User=‘root‘;
7、最后刷新一下:flush privileges;
\#一定要记得在写sql的时候要在语句完成后加上" ; "下面是图示说明

遇到这个问题首先到mysql所在的服务器上用连接进行处理
连接服务器: mysql -u root -p

查看当前所有数据库:show databases;

进入mysql数据库:use mysql;

查看mysql数据库中所有的表:show tables;

查看user表中的数据:select Host, User,Password from user;

修改user表中的Host:update user set Host=‘%‘ where User=‘root‘;

最后刷新一下:flush privileges;

重新在Navicate中测试一下:

第一种问题的解决办法是:
在iptables中开放3306端口
\#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
\#/etc/rc.d/init.d/iptables save 保存:
\# service iptables restart 重启生效
\############################################################################################
iptables -I INPUT -p TCP -s 0.0.0.0/0 --dport 3306 -j ACCEPT //我常用的在iptables中开放3306端口命令
第二种解决方法是:
设置远程用户访问权限:
// 任何远程主机都可以访问数据库
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘WITH GRANT OPTION;
//需要输入次命令使修改生效
mysql> FLUSH PRIVILEGES;
//退出
mysql> EXIT
第三种不解释了.
(还有一种方法说是关闭服务器防火墙:# service iptables stop 不建议使用这种方法,会引发未知的安全问题)
很明显最后还是没有解决,在网上的资料很多都是重复的,最后实在没办法,找了师兄帮忙才发现是阿里云控制台这边的问题,说明自己思考的方向还是不对.具体的解决方法是:
打开云服务器ECS
打开左边菜单的实例
打开实例最右边的管理
打开左边菜单的本实例安全组
打开右边的配置规则
右上角添加安全组规则
协议类型默认自定义,端口范围:3306/3306,授权对象:0.0.0.0/0,其他默认就行
确定后重启服务器
连接OK!
标签:option 使用 自定义 方法 use 进入 管理 其他 inpu
原文地址:https://www.cnblogs.com/guoyinghome/p/11199490.html