ubuntu mysql5.7 启动提示错误 mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
使用 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#16 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
12 月 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#16 Sense Key : Medium Error [current]
12 月 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#16 Add. Sense: Unrecovered read error
12 月 10 11:49:38 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#16 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#22 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
12 月 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#22 Sense Key : Medium Error [current]
12 月 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#22 Add. Sense: Unrecovered read error
12 月 10 11:50:09 user-70DGA014CN kernel: sd 2:0:0:0: [sda] tag#22 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
使用 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
这个怎么处理??
1
master 2018-12-10 16:07:49 +08:00
你的第一行错误 不是启动 mysql 失败 而是 mysql 客户端连接本地 socket 失败 说明你 mysql 服务没有启动成功
而目前看报错是 apparmor 让 mysql 服务 没有部分路劲的访问权限 处理办法就是配置 apparmor 让他允许 mysql 的这些访问权限 你可以谷歌一下 |
2
auxox 2018-12-10 16:45:41 +08:00
连接 mysql server 的时候,用 mysql -h 127.0.0.1 试试
|
3
FYK 2018-12-10 17:15:05 +08:00
|
4
1406075864 2018-12-10 18:34:07 +08:00
他不一定是这个 socket 这个文件有问题, 有可能是你 my.cfg 这个文件有问题 ,把其他配置进行排除一下 留下最简单的配置 应该会可以
|
5
liyer 2018-12-10 18:39:58 +08:00
kill -9 mysql
service mysql start |
6
LinSP 2018-12-10 19:28:15 +08:00
mysql-server 没装吧,就装了 mysql client。否则一般 mysql server 的 service 是 mysqld 而不是 mysql
|
7
ik 2018-12-10 20:03:02 +08:00 via iPhone
你这是用 mysql 命令的吧?
|
8
dongisking 2018-12-10 22:30:47 +08:00 via Android
看来 docker 还是很有必要的
|
9
luckybearops 2018-12-10 22:45:57 +08:00
这个问题是因为你的 mysql 通过 socket 连接访问,但是因为你的配置文件原因,导致 socket 没有找到。
解决办法如下: 1、去除 /etc/my.cnf 关于 socket 部分的设置,重新启动 mysql 服务。 2、使用 mysql -u root -h 127.0.0.1 -p 方式登录。 |
10
YanwenSun 2018-12-10 22:50:45 +08:00 via Android
硬盘 UNC 先解决吧
|
11
sunny2580839896 2020-05-02 23:01:51 +08:00
mysql.service 文件可以分享下吗??
|