简体   繁体   中英

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)

but I have already installed mysql-server but it still doesn't work

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.

To locate the socket, be sure that your mysql-server is running, then type sudo locate mysqld.sock in your terminal.

Then, you have to edit your php.ini file and find the mysql.default_socket to assign it the path of the socket. Restart apache and/or php-fpm if you use it and voilà !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM