[英]Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I was trying to setup owncloud on WSL ubuntu but i am stuck on setting up mysql user and database since it popped up this: Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
我试图在 WSL ubuntu 上设置 owncloud 但我一直坚持设置 mysql 用户和数据库,因为它弹出这个:
Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
but I have already installed mysql-server
but it still doesn't work但是我已经安装了
mysql-server
但是还是不行
It happen sometimes when you install mysql-server after php. You must locate your php.ini file and edit it with the good mysqld.sock
path.当您在 php 之后安装 mysql-server 时,有时会发生这种情况。您必须找到您的 php.ini 文件并使用正确的
mysqld.sock
路径对其进行编辑。
To locate the socket, be sure that your mysql-server is running, then type sudo locate mysqld.sock
in your terminal.要找到套接字,请确保您的 mysql-server 正在运行,然后在您的终端中键入
sudo locate mysqld.sock
。
Then, you have to edit your php.ini
file and find the mysql.default_socket
to assign it the path of the socket.然后,您必须编辑
php.ini
文件并找到mysql.default_socket
为其分配套接字的路径。 Restart apache and/or php-fpm
if you use it and voilà !重启 apache 和/或
php-fpm
,如果你使用它,瞧!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.