欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

mysql远程连接/访问速度慢的解决方案 远程连接太慢很慢非常慢 自己亲自做的 有大用 有大大用

连接阿里云服务器上的数据库,速度很慢

账户密码正确

已关闭防火墙

修改 /etc/my.cnf,添加配置skip-name-resolve 

 (改的是连接的mysql服务器所在的那台电脑的my.cnf,不是客户端的电脑my.cnf)

[mysqld]
skip-name-resolve

 在连接远程数据库的时候,直接跳过MySQL的DNS解析


重启mysqld服务,解决。

[root@ebs-25879 ~]# vim /home/wddata/etc/my.cnf

# mysql conf /etc/my.cnf

# Created by http://www.wdlinux.cn

# Last Updated 2010.06.01


[client]

port            = 3306

socket          = /tmp/mysql.sock

[mysqld]

port            = 3306

socket          = /tmp/mysql.sock

innodb_file_per_table

skip-external-locking

skip-name-resolve   # 可能单独加这个选项会出问题,所以这里把整个my.cnf文件全列出来,因为有可能有其它的选项与这个选项相关

key_buffer_size = 128M

max_allowed_packet = 512M

table_open_cache = 256

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 2M

myisam_sort_buffer_size = 8M

thread_cache_size = 8

query_cache_size= 16M

thread_concurrency = 8

max_connections = 300

wait_timeout = 30

interactive_timeout = 30

max_connect_errors = 9

long_query_time = 1

tmp_table_size = 16M

#log-bin=mysql-bin

#binlog_format=mixed

#server-id      = 1

innodb_buffer_pool_size=16M

[mysqldump]

quick

max_allowed_packet = 8M

[mysql]

no-auto-rehash

[myisamchk]

key_buffer_size = 12M

sort_buffer_size = 1M

read_buffer = 1M

write_buffer = 1M

[mysqlhotcopy]

interactive-timeout



普通分类: