基本操作系统: Centos 7 Atomic Host
我安装了 Mariadb 10.2 &将数据目录更改为/ home目录下的文件夹。我对/etc/my.cnf进行了相应的更改,以指向数据目录& mysql套接字。我也在SE linux上下文中做了相关的更改。 现在,当我通过 systemctl start mariadb 启动mariadb服务时,它失败了。 系统状态mariadb.service 的输出为
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Tue 2017-09-12 13:54:15 CEST; 23s ago
Process: 3099 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 3066 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 3063 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 3099 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
/etc/my.cnf 是
[client-server]
[mysqld]
datadir=/home/data/db/mysql
socket=/home/data/db/mysql/mysql.sock
[client]
port=3306
socket=/home/data/db/mysql/mysql.sock
关于如何让MariaDB升级的任何想法运行
答案 0 :(得分:1)
最后,我得到了解决方案。下面的链接可以帮助任何陷入类似问题的人。第一项任务是执行更改mariadb& amp;的数据目录的常用程序。第二个任务是允许mariadb.service使用/ home作为数据存储的基本目录。
任务1:
在Tecmint.com上关注by Gabriel Cánepa's advice:
1.1。更改默认的MySQL / MariaDB数据目录
# mkdir /mnt/mysql-data
# chown -R mysql:mysql /mnt/mysql-data
1.2。识别当前的MySQL数据目录
# mysql -u root -p -e "SELECT @@datadir;"
1.3。将MySQL数据目录复制到新位置
# systemctl stop mariadb
# systemctl is-active mariadb
# cp -R -p /var/lib/mysql/* /mnt/mysql-data
1.4。配置新的MySQL数据目录
# vi /etc/my.conf
[mysqld]:
datadir=/mnt/mysql-data
socket=/mnt/mysql-data/mysql.sock
[client]:
port=3306
socket=/mnt/mysql-data/mysql.sock
1.5.Set SELux安全上下文到数据目录
# semanage fcontext -a -t mysqld_db_t "/mnt/mysql-data(/.*)?"
# restorecon -R /mnt/mysql-data
1.6。在任务2
之后重启mariadb.service# systemctl start mariadb
1.7。验证位置
# mysql -u root -p -e "SELECT @@datadir;"
任务2:
要从 / home 运行MariaDB SQL,请在文件 /usr/lib/systemd/system/mariadb.servic e中,只需更改:
ProtectHome=true
到:
ProtectHome=false