MySQL出现SQL
Error (2013)连接错误解决办法
问题描述:
1、通过Navicat
11客户端工具远程连接mysql数据库,报错如下:
http://s15/mw690/006yMqMOzy7fxIhcb1k6e&690Error (2013)连接错误解决办法" TITLE="MySQL出现SQL Error (2013)连接错误解决办法" />2、登录mysql数据库服务端查看日志告警如下:
[root@lamp ~]# tail -f lamp.com.err
2017-11-04T07:21:23.947219Z 0 [Note] Server socket created on IP:
'::'.
2017-11-04T07:21:23.948493Z 0 [Note] InnoDB: Loading buffer pool(s)
from /data/ib_buffer_pool
2017-11-04T07:21:23.951283Z 0 [Note] InnoDB: Buffer pool(s) load
completed at 171104 15:21:23
2017-11-04T07:21:23.964221Z 0 [Note] Event Scheduler: Loaded 0
events
2017-11-04T07:21:23.964407Z 0 [Note] Executing 'SELECT * FROM
INFORMATION_SCHEMA.TABLES;' to get a list of tables using the
deprecated partition engine. You may use the startup option
'--disable-partition-engine-check' to skip this check.
2017-11-04T07:21:23.964418Z 0 [Note] Beginning of list of
non-natively partitioned tables
2017-11-04T07:21:23.983983Z 0 [Note] End of list of non-natively
partitioned tables
2017-11-04T07:21:23.984116Z 0 [Note] /usr/local/mysql/bin/mysqld:
ready for connections.
Version: '5.7.17' socket:
'/tmp/mysql.sock' port: 3306
MySQL Community Server (GPL)
2017-11-04T07:21:52.112920Z 3 [Warning] IP
address '172.16.0.1' could not be resolved: Temporary failure in
name resolution
解决办法:
1、编辑mysql数据库配置文件/etc/my.cnf,在配置文件中的[mysqld]选项下添加skip-name-resolve
[root@lamp ~]# vi /etc/my.cnf
# For advice on how to change settings please see
#
http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied
to the
# *** default location during install, and will be replaced if
you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most
important data
# cache in MySQL. Start at 70% of total RAM for dedicated server,
else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity
option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
basedir = /usr/local/mysql
datadir = /data
port = 3306
socket = /tmp/mysql.sock
# Remove leading # to set options mainly useful for reporting
servers.
# The server defaults are faster for transactions and fast
SELECTs.
# Adjust sizes as needed, experiment to find the optimal
values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-name-resolve
2、重启mysql服务
[root@lamp ~]# service mysqld restart
Navicat
11客户端再次远程连接成功
http://s4/mw690/006yMqMOzy7fxIWkBr563&690Error (2013)连接错误解决办法" TITLE="MySQL出现SQL Error (2013)连接错误解决办法" />
加载中,请稍候......