\ ubuntu mysql5.7 startup prompt error: / var/run/mysqld/mysqld.sock??

ubuntu mysql5.7 startup prompt error
mysql start

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

use journalctl-xe

journalctl -xe
12 10 11:49:38 user-70DGA014CN kernel: ata3.00: configured for UDMA/133
12 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp16 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
12 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp16 Sense Key : Medium Error [current] 
12 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp16 Add. Sense: Unrecovered read error
12 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp16 CDB: Read(16) 88 00 00 00 00 00 5c 56 24 c0 00 00 00 08 00 00
12 10 11:49:38 user-70DGA014CN kernel: print_req_error: I/O error, dev sda, sector 1549149383
12 10 11:49:38 user-70DGA014CN kernel: ata3: EH complete
12 10 11:49:38 user-70DGA014CN systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
12 10 11:50:05 user-70DGA014CN systemd[1]: Failed to start MySQL Community Server.
-- Subject: mysql.service 
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- mysql.service 
-- 
-- "failed" 
12 10 11:50:05 user-70DGA014CN systemd[1]: mysql.service: Unit entered failed state.
12 10 11:50:05 user-70DGA014CN systemd[1]: mysql.service: Failed with result "exit-code".
12 10 11:50:05 user-70DGA014CN systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
12 10 11:50:05 user-70DGA014CN systemd[1]: Stopped MySQL Community Server.
-- Subject: mysql.service 
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- mysql.service 
12 10 11:50:05 user-70DGA014CN systemd[1]: Starting MySQL Community Server...
-- Subject: mysql.service 
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- mysql.service 
12 10 11:50:05 user-70DGA014CN audit[8266]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8266/status" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=123
12 10 11:50:05 user-70DGA014CN kernel: audit: type=1400 audit(1544413805.884:13993): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8266/status" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=123
12 10 11:50:05 user-70DGA014CN kernel: audit: type=1400 audit(1544413805.884:13994): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=0
12 10 11:50:05 user-70DGA014CN kernel: audit: type=1400 audit(1544413805.884:13995): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8266/status" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=123
12 10 11:50:05 user-70DGA014CN audit[8266]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=0
12 10 11:50:05 user-70DGA014CN audit[8266]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8266/status" pid=8266 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=123 ouid=123
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: exception Emask 0x0 SAct 0x400000 SErr 0x0 action 0x0
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: irq_stat 0x40000008
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: failed command: READ FPDMA QUEUED
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: cmd 60/08:b0:c0:24:56/00:00:5c:00:00/40 tag 22 ncq dma 4096 in
                                                   res 43/40:08:c7:24:56/00:00:5c:00:00/00 Emask 0x408 (media error) <F>
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: status: { DRDY SENSE ERR }
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: error: { UNC }
12 10 11:50:09 user-70DGA014CN kernel: ata3.00: configured for UDMA/133
12 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp22 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
12 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp22 Sense Key : Medium Error [current] 
12 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp22 Add. Sense: Unrecovered read error
12 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag-sharp22 CDB: Read(16) 88 00 00 00 00 00 5c 56 24 c0 00 00 00 08 00 00
12 10 11:50:09 user-70DGA014CN kernel: print_req_error: I/O error, dev sda, sector 1549149383
12 10 11:50:09 user-70DGA014CN kernel: ata3: EH complete
12 10 11:50:09 user-70DGA014CN systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

use systemctl status mysql.service

>>> systemctl status mysql.service
 mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since  2018-12-10 11:53:08 CST; 8s ago
  Process: 8815 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 8807 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 8815 (code=exited, status=2);         : 8816 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           control
             8816 /bin/bash /usr/share/mysql/mysql-systemd-start post
             8852 sleep 1

12 10 11:53:08 user-70DGA014CN systemd[1]: Starting MySQL Community Server...
12 10 11:53:12 user-70DGA014CN systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

Jan.25,2022

take a look at the error log of mysql. It is possible that the permissions of a certain directory are incorrect, causing files such as pid to fail to create


start the database, and click error.log, to see if there is any error message.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eba876-27e1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eba876-27e1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?