linux centos7mariadb安装成功启动不了 解决思路
查看系统日志/var/log/mariadb/mariadb.log
190313 14:31:03 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 190313 14:31:03 InnoDB: Waiting for the background threads to start 190313 14:31:04 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 1597945 190313 14:31:04 [Note] Plugin 'FEEDBACK' is disabled. 190313 14:31:04 [ERROR] mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 190313 14:31:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 190313 14:31:04 [Note] Server socket created on IP: '0.0.0.0'. 190313 14:31:04 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13) 190313 14:31:04 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13) 190313 14:31:04 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended 190313 14:32:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 190313 14:32:37 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 4335 ... 190313 14:32:37 InnoDB: The InnoDB memory heap is disabled 190313 14:32:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins 190313 14:32:37 InnoDB: Compressed tables use zlib 1.2.7 190313 14:32:37 InnoDB: Using Linux native AIO 190313 14:32:37 InnoDB: Initializing buffer pool, size = 128.0M 190313 14:32:37 InnoDB: Completed initialization of buffer pool
提示没有找到plugin.frm,但是用find查找了一下,是存在的;
Can't find file: './mysql/plugin.frm'
谷歌了一下,是mysql的权限问题,如下为解决办法:
改变mysql目录的拥有者为mysql
chown –R mysql:mysql /var/lib/mysql/
结果如下:
重启mariadb:systemctl restart mariadb.service
验证下结果:systemctl startus mariadb.service
mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-03-14 10:17:55 CST; 21s ago
Process: 15355 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 15326 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 15354 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─15354 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─15512 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/m...
Mar 14 10:17:53 VMS94897 systemd[1]: Starting MariaDB database server...
Mar 14 10:17:53 VMS94897 mysqld_safe[15354]: 190314 10:17:53 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Mar 14 10:17:53 VMS94897 mysqld_safe[15354]: 190314 10:17:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 14 10:17:55 VMS94897 systemd[1]: Started MariaDB database server.