Score:0

socket doesn't exist; Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

sz flag

I know the problem isn't new. But I have tried lots of thing. What I couldn't figure out is, socket wasn't available since I downloaded mysql.

/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf

None of the above files are available. I had downloaded mysql-server at first. As it wasn't working I downloaded MariaDB. Still not working. What I can do with MySql is enable, restart (but not start) and version check. I can't find out anything else I could do.

tried all the following links and more. 1, 2, 3

$-mysql -u root -p -h 127.0.0.1
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)

I get the following message if I execute systemctl status mysql.

mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-10-25 20:28:52 +06; 12min ago
    Process: 23398 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
        CPU: 4ms

অক্টোবর 25 20:28:52 istiak-PASSION-BX-PRO systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
অক্টোবর 25 20:28:52 istiak-PASSION-BX-PRO systemd[1]: Stopped MySQL Community Server.
অক্টোবর 25 20:28:52 istiak-PASSION-BX-PRO systemd[1]: mysql.service: Start request repeated too quickly.
অক্টোবর 25 20:28:52 istiak-PASSION-BX-PRO systemd[1]: mysql.service: Failed with result 'exit-code'.
অক্টোবর 25 20:28:52 istiak-PASSION-BX-PRO systemd[1]: Failed to start MySQL Community Server.

I tried reinstalling mysql-server still same issue. FYI, I had installed them with lampp-server also but I can't find lampp folder/file also.

/etc/mysql$ ls
mariadb.conf.d  mysql.conf.d

mariadb.conf.d has 50-client.cnf.dpkg-new 50-mysql-clients.cnf.dpkg-new 60-galera.cnf.dpkg-new and mysql.conf.d is empty.

$ locate mysql.cnf
/etc/mysql/mysql.cnf
/etc/mysql/mysql.conf.d/mysql.cnf

but

/etc/mysql/mysql.conf.d$ cat mysql.cnf
cat: mysql.cnf: No such file or directory
$ cat /var/log/mysql/error.log
2022-10-25T07:48:52.228831Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) initializing of server in progress as process 28839
2022-10-25T07:48:52.302162Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-25T07:49:09.874747Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-25T07:50:06.236820Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-10-25T07:51:08.281884Z 6 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.31-0ubuntu0.22.04.1).
2022-10-25T07:51:38.826105Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 28898
2022-10-25T07:51:39.554318Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-25T07:51:41.855856Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-25T07:51:46.281301Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-10-25T07:51:46.281340Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-10-25T07:51:46.333725Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2022-10-25T07:51:46.379072Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2022-10-25T07:51:46.379082Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.22.04.1'  socket: '/tmp/tmp.AGSySmwCxw/mysqld.sock'  port: 0  (Ubuntu).
2022-10-25T07:51:46.647513Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.22.04.1).
2022-10-25T07:51:51.615872Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.22.04.1)  (Ubuntu).
2022-10-25T07:51:52.202270Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 28983
2022-10-25T07:51:52.209027Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-25T07:51:54.558257Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-25T07:51:57.829629Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-10-25T07:51:57.829657Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-10-25T07:51:57.889261Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2022-10-25T07:51:58.081569Z 7 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.31-0ubuntu0.22.04.1).
2022-10-25T07:51:58.085366Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-10-25T07:52:01.902843Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.22.04.1)  (Ubuntu).
2022-10-25T07:52:03.914295Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 29105
2022-10-25T07:52:04.447669Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-25T07:52:06.721404Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-25T07:52:10.519027Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-10-25T07:52:10.519055Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-10-25T07:52:10.536998Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-10-25T07:52:10.537077Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.22.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).
2022-10-25T08:14:19.130322Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 1057
2022-10-25T08:14:20.074090Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-25T08:14:33.814659Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-25T08:14:37.852644Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2022-10-25T08:14:37.862734Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2022-10-25T08:14:38.881437Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-10-25T08:14:38.881467Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-10-25T08:14:39.184636Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-10-25T08:14:39.184667Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.22.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).
2022-10-25T08:27:57.845047Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.22.04.1).
2022-10-25T08:27:59.876899Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.22.04.1)  (Ubuntu).
Billy Istiak avatar
sz flag
I can't see any issue in error.log. All I can think is, I don't have socket and no file of configuring mysql.
Billy Istiak avatar
sz flag
I am facing the problem whole day, still couldn't solve. Your little help will save my another day. For the shitty problem, I dared to change OS. But my RAM isn't that good enough to use Android-Studio in WIndows.
Score:0
sz flag

After thinking longer than usual, I realized the MySQL is completely broken in my system. Even while removing MySQL, there's always some files left behind. SO I directly installed a new distribution again. Again downloaded Xampp from official page.

$cd Downloads
$sudo chmod +x xampp.run
$sudo ./xampp.run

Then a dialog box (installation) appear, after completing the installation, I got a Lampp folder in /opt. And a lampp executable file /opt/lampp/lampp

cd /opt/lampp
sudo ./lampp start

If lampp isn't executable then run

sudo chmod +x lampp 
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.