【发布时间】:2019-09-14 14:42:08
【问题描述】:
mysql(有充分的理由)在 XAMPP mysql 服务器位于“localhost”时非常努力地连接到套接字文件。但是由于 Win64 mysqld 当然不会在 Windows Subsystem for Linux 文件系统中删除套接字文件,因此无法通过套接字文件进行连接。如何强制它使用端口?
$ mysql --port=3306 -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directo
ry")
Nmap 显示端口 3306 是可访问的。
$ nmap localhost -p 3306
Starting Nmap 7.60 ( https://nmap.org ) at 2019-04-25 09:58 DST
Problem binding to interface , errno: 92
socket_bindtodevice: Protocol not available
Problem binding to interface , errno: 92
socket_bindtodevice: Protocol not available
Problem binding to interface , errno: 92
socket_bindtodevice: Protocol not available
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0019s latency).
PORT STATE SERVICE
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
如果不需要,我宁愿不将 mysqld 绑定到我的外部网络。
我如何告诉 mysql 软件,“我知道你的想法,但请使用端口 3306,而不是套接字”?最好我也想知道如何向 PHP 传达同样的信息。
【问题讨论】:
标签: mysql sockets xampp windows-subsystem-for-linux