Very slow (1 second) connections

强颜欢笑 提交于 2019-12-05 18:37:09

Doh! Looks like this is a dupe. See:

Why is connecting to MySQL server so slow?

https://serverfault.com/questions/408550/connecting-to-mysql-from-php-is-extremely-slow

I've got IPv6 enabled on the 64-bit machine and not the 32-bit machine. When I connect with the following alternate string, things are much quicker:

mysql -h 127.0.0.1 -u root -D myschema 0< myscript.sql

Still not sure why this is happening, but at least there's a workaround! Alas poor localhost I knew him well.

EDIT: The following change to my.ini allows use of localhost in scripts and connection strings:

bind-address=::1

Note: Binding to ::ffff:127.0.0.1 or localhost didn't seem to help. I read about binding both IPv6 and IPv4 addresses to MySQL server so all 3 connection strings would work (e.g. -h ::1, -h 127.0.0.1, -h localhost). However, I was only able to get one or two of those client strings to work at a time.

EDIT2: Binding in the following way:

bind-address=*

Completely resolves this issue and both IPv4 and IPv6 clients can connect. The only drawback being that remote connections are now allowed. I haven't found a way to use TCP with localhost restrictions and bind to both 127.0.0.1 and ::1.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!