• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

连接mysql数据库报错解决方法_MySQL

mysql 搞代码 4年前 (2022-01-09) 20次浏览 已收录 0个评论

gaodaima.com

连接mysql数据库报错解决方法

1.mysql 错误 ERROR 本文来源gaodai#ma#com搞*!代#%^码网%2003 (HY000): Can't connect to MySQL server on 'localhost'

解决办法:关闭防火墙,linux下命令

[root@etl01 bin]# chkconfig –list | grep -i iptables ====check fire wall

iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@etl01 bin]# /sbin/service iptables stop ====stop fire wall

Flushing firewall rules: [ OK ]

Setting chains to policy ACCEPT: nat filter [ OK ]

Unloading iptables modules: [ OK ]

2.报错:1130-host … is not allowed to connect to this MySql server

解决办法:

授权形式

比如账户为root,密码为root

use mysql;

用root账户从任何主机上访问mysql数据库了

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

如果你想允许用户zz从ip为192.168.1.3的主机连接到mysql服务器,并使用123456作为密码

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY '123456' WITH GRANT OPTION;

gaodaima.com


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:连接mysql数据库报错解决方法_MySQL

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址