欢迎光临
这是我的个人博客

MySql数据库远程连接慢的问题(MySql5.7)

【windows】

原理:配置参数关闭DNS解析

MySql配置参数增加skip-name-resolve

配置文件:My.ini 在C:\ProgramData\MySQL\MySQL Server 5.7\my.ini

[mysqld] 节点下增加以下行(注意节点名称是mysqld,不是mysql)
skip-name-resolve

重新启动Mysql就可以了;

停止MySql 命令:Net Stop MySql57

开始MySql命令:Net Start MySql57

[linux]

在Linux下配置文件是/etc/my.cnf,

[mysqld] 节点下增加以下行
skip-name-resolve ,然后重启mysql  

service mysqld restart

如下:

[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
#
# 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
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#skip-grant-tables
skip-name-resolve

赞(1)
未经允许不得转载:好好网 » MySql数据库远程连接慢的问题(MySql5.7)

评论 抢沙发

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