익명 18:49

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I am an Ubuntu novice and am looking for some help from experts. I downloaded an Ubuntu app from Windows (I use Windows 10) because I wanted to download Siberian CMS, a free open-source app maker. I have successfully installed Apache2 and am stuck in the installation process for MariaDB and PHP. I have been following the steps in the link attached. Long story short, when I type "sudo mysql_secure_installation" i get "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)". I have been stuck at this phase forever and am desperate for help!

https://websiteforstudents.com/install-siberian-cms-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-2/



Top Answer/Comment:

I encountered that error while installing Nextcloud and wrote a small article on how I managed to fix HY000 [2002]. You can check it for details but I think it is worth to try these things first:

  • Disable SSL for now - go to /etc/mysql/mariadb.conf.d/50-server.cnf and comment this out: ssl=on
  • Ensure you can read and write to the socket: sudo chmod 777 /var/run/mysqld/mysqld.sock

  • It may be, for some reason, that your socket is somewhere else. You can check where your server creates the socket in /etc/mysql/mariadb.conf.d/50-server.cnf file. Search for a line starting with socket =. If that's the case then change this line to point at /var/run/mysqld/mysqld.sock

Don't forget to restart your mysql server after taking these steps with sudo systemctl restart mysql

상단 광고의 [X] 버튼을 누르면 내용이 보입니다