在 Arch Linux 上启动 mariaDB 服务失败
Start mariaDB service on Archlinux faild
这是我第一次使用mysql,我知道mariadb是mysql在archlinux上的官方实现。一开始我并没有按照archwiki上的方法启动,而是直接执行了mysqld。之后报错,于是去archwiki找解决办法。
我按照步骤执行了这个
# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
这之后报错如下
× mariadb.service - MariaDB 10.5.10 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2021-06-19 11:15:50 CST; 1min 4s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1961 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1962 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 1970 ExecStart=/usr/bin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 1970 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
CPU: 70ms
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Plugin 'InnoDB' init function returned error.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Failed to initialize plugins.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Aborting
6月 19 11:15:50 wilson systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
6月 19 11:15:50 wilson systemd[1]: mariadb.service: Failed with result 'exit-code'.
6月 19 11:15:50 wilson systemd[1]: Failed to start MariaDB 10.5.10 database server.
然后我将当前用户添加到 mysql 用户组。但问题依然存在。
我能怎么做?谁能帮我一个忙?
这条消息很好地指示出了什么问题:
The innodb_system data file 'ibdata1' must be writable
如果文件不可写,则可能是以下情况之一:
- 您没有从
root
帐户启动服务
- 数据库的数据目录设置了错误的权限
对于第一项,请务必在命令前加上 sudo
前缀。 MySQL/MariaDB(通常)无法从普通用户帐户启动。
其次,确认数据目录(通常/var/lib/MySQL
归MySQL用户所有并且文件权限被适当限制(MySQL拒绝运行 如果数据或日志记录目录是 777
或 755
).
这是我第一次使用mysql,我知道mariadb是mysql在archlinux上的官方实现。一开始我并没有按照archwiki上的方法启动,而是直接执行了mysqld。之后报错,于是去archwiki找解决办法。 我按照步骤执行了这个
# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
这之后报错如下
× mariadb.service - MariaDB 10.5.10 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2021-06-19 11:15:50 CST; 1min 4s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1961 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1962 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 1970 ExecStart=/usr/bin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 1970 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
CPU: 70ms
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Plugin 'InnoDB' init function returned error.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Failed to initialize plugins.
6月 19 11:15:50 wilson mariadbd[1970]: 2021-06-19 11:15:50 0 [ERROR] Aborting
6月 19 11:15:50 wilson systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
6月 19 11:15:50 wilson systemd[1]: mariadb.service: Failed with result 'exit-code'.
6月 19 11:15:50 wilson systemd[1]: Failed to start MariaDB 10.5.10 database server.
然后我将当前用户添加到 mysql 用户组。但问题依然存在。 我能怎么做?谁能帮我一个忙?
这条消息很好地指示出了什么问题:
The innodb_system data file 'ibdata1' must be writable
如果文件不可写,则可能是以下情况之一:
- 您没有从
root
帐户启动服务 - 数据库的数据目录设置了错误的权限
对于第一项,请务必在命令前加上 sudo
前缀。 MySQL/MariaDB(通常)无法从普通用户帐户启动。
其次,确认数据目录(通常/var/lib/MySQL
归MySQL用户所有并且文件权限被适当限制(MySQL拒绝运行 如果数据或日志记录目录是 777
或 755
).