Linux下Mysql常见连接错误
2015-06-27 21:31
627 查看
遇到这些问题,网上很多解决方案,一搜就有。在这我简单总结下
第一个:ERROR 2003 (HY000): Can't connect to MySQL server on '172.29.*.*' (113)
无法连接,可能有几个原因:
1、防火墙,看下iptables
2、配置文件中绑定了ip,检查bind adderss (my.cnf)
3、配置文件中skip-networking
第二个:ERROR 1130 (HY000): Host '192.168.*.*' is not allowed to connect to this MySQL server
在远程连接时候出现,因为没有权限。
可以使用下面语句给予权限:
其中192.168.*.*是本地ip,root和1234是允许的登录名和密码,这么连接就安全多了。
如果不限制ip,用%表示所有。
第三个:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
是因为忘记密码了。。
最简单方式:/etc/mysql/my.cnf 或/etc/my.cnf
加入skip-grant-tables
重启mysql服务:service mysqld restart
可以直接进入:mysql -u root
执行改密码:update user set password('password') where user = 'root';
把my.cnf中的skip-grant-tables去掉,重启服务
第一个:ERROR 2003 (HY000): Can't connect to MySQL server on '172.29.*.*' (113)
无法连接,可能有几个原因:
1、防火墙,看下iptables
2、配置文件中绑定了ip,检查bind adderss (my.cnf)
3、配置文件中skip-networking
第二个:ERROR 1130 (HY000): Host '192.168.*.*' is not allowed to connect to this MySQL server
在远程连接时候出现,因为没有权限。
可以使用下面语句给予权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.*.*' IDENTIFIED BY '1234' WITH GRANT OPTION;
其中192.168.*.*是本地ip,root和1234是允许的登录名和密码,这么连接就安全多了。
如果不限制ip,用%表示所有。
第三个:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
是因为忘记密码了。。
最简单方式:/etc/mysql/my.cnf 或/etc/my.cnf
加入skip-grant-tables
重启mysql服务:service mysqld restart
可以直接进入:mysql -u root
执行改密码:update user set password('password') where user = 'root';
把my.cnf中的skip-grant-tables去掉,重启服务
相关文章推荐
- Linux Shell脚本之自动修改IP
- linux vi编辑常用命令
- Linux远程连接putty出现Network Erroe: Software caused connection abort
- linux命令
- linux 环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
- 虚拟机Linux----Ubuntu1204----安装jdk1.8
- linux常用命令的英文单词缩写
- Linux图形界面与字符界面切换
- [Linux]在终端启动程序关闭终端不退出的方法
- linux下一个eclipse组态jdk
- linux程序设计——make命令和makefile文件(第九章)
- Linux 下终端 C 语言控制光标的技巧
- CentOS7 (64位) 下QT5.5 连接MySQL数据库(driver not loaded)
- 虚拟机Linux----Ubuntu1204----设置固定Ip
- Linux1.0内核中断体系的建立
- Linux 下crontab简单使用
- Linux访问受限,访问Linux总是Forbidden
- Linux中强制结束一个进程的终极方法
- Linux虚拟机与外面系统ping不通,或者连不上网
- Linux cp 命令