Starting MySQL. ERROR! The server quit without updating PID file (/mysql3306/data/mysql.pid).
1、MySQL数据库启动报错
[root@mysql ~]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/mysql3306/data/mysql.pid).
2、排查错误日志
024-01-16T00:46:46.435107Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-01-16T00:46:46.444333Z 0 [Warning] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory. 2024-01-16T00:46:46.444418Z 0 [Note] /mysql3306/bin/mysqld (mysqld 5.7.26-log) starting as process 2110 ... mysqld: File '/mysql3306/binlog/binlog.index' not found (Errcode: 13 - Permission denied) 2024-01-16T00:46:46.448174Z 0 [ERROR] Aborting 2024-01-16T00:46:46.448194Z 0 [Note] Binlog end 2024-01-16T00:46:46.448337Z 0 [Note] /mysql3306/bin/mysqld: Shutdown complete
具体报错为 mysqld: File '/mysql3306/binlog/binlog.index' not found (Errcode: 13 - Permission denied)
3、排查data目录下的属主(由于昨天导如数据)
[root@mysql data]# ll total 630920 -rw-r----- 1 mysql mysql 56 Jan 4 01:32 auto.cnf -rw------- 1 mysql mysql 1675 Jan 13 06:23 ca-key.pem -rw-r--r-- 1 mysql mysql 1107 Jan 13 06:23 ca.pem -rw-r--r-- 1 mysql mysql 1107 Jan 13 06:23 client-cert.pem -rw------- 1 mysql mysql 1675 Jan 13 06:23 client-key.pem drwxr-x--- 2 mysql mysql 228 Jan 15 04:35 db1 drwxr-x--- 2 mysql mysql 102 Jan 4 01:27 db2 drwxr-x--- 2 mysql mysql 98 Jan 4 01:27 db3 drwxr-x--- 2 mysql mysql 90 Jan 4 02:01 db_itheima drwxr-x--- 2 root root 100 Jan 15 04:10 dbt3 -rw-r----- 1 mysql mysql 336720638 Jan 15 04:53 general.log -rw-r----- 1 root root 17462 Jan 15 04:53 ib_buffer_pool -rw-r----- 1 mysql mysql 79691776 Jan 15 04:54 ibdata1 -rw-r----- 1 mysql mysql 50331648 Jan 15 04:54 ib_logfile0 -rw-r----- 1 mysql mysql 50331648 Jan 15 04:52 ib_logfile1 drwxr-x--- 2 mysql mysql 48 Jan 4 01:27 liang drwxr-x--- 2 mysql mysql 4096 Jan 4 01:27 mysql drwxr-x--- 2 mysql mysql 8192 Jan 4 01:27 performance_schema -rw------- 1 mysql mysql 1675 Jan 13 06:23 private_key.pem -rw-r--r-- 1 mysql mysql 451 Jan 13 06:23 public_key.pem -rw-r--r-- 1 mysql mysql 1107 Jan 13 06:23 server-cert.pem -rw------- 1 mysql mysql 1675 Jan 13 06:23 server-key.pem -rw-r----- 1 mysql mysql 128882889 Jan 15 04:53 slow.log -rw-r----- 1 mysql mysql 356 Jan 14 01:42 slow_new.log drwxr-x--- 2 mysql mysql 8192 Jan 4 01:27 sys drwxr-x--- 2 mysql mysql 90 Jan 14 19:39 test drwxr-x--- 2 mysql mysql 52 Jan 4 01:27 wen -rw-r----- 1 mysql mysql 19 Jan 4 01:27 xtrabackup_binlog_pos_innodb -rw-r----- 1 mysql mysql 471 Jan 4 01:27 xtrabackup_inf
4、将data下的属主都改为mysql
[root@mysql mysql3306]# chown -R mysql:mysql data
5、启动依旧报错
[root@mysql ~]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/mysql3306/data/mysql.pid).
6、依据第二步报错信息查看binlog.index的属主
-rw-r----- 1 mysql mysql 177 Jan 15 01:16 binlog.000040 -rw-r----- 1 mysql mysql 177 Jan 15 02:37 binlog.000041 -rw-r----- 1 root root 177 Jan 15 02:48 binlog.000042 -rw-r----- 1 root root 1512 Jan 15 04:52 binlog.000043 -rw-r----- 1 root root 198 Jan 15 04:53 binlog.000044 -rw-r----- 1 root root 177 Jan 15 04:53 binlog.000045 -rw-r----- 1 root root 1440 Jan 15 04:53 binlog.index
7、修改binlog.index的属主
root@mysql mysql3306]# chown -R mysql:mysql binlog
8、启动成功
[root@mysql ~]# service mysqld start
Starting MySQL. SUCCESS!