我正在使用centos7.3,安装mariadb 10.3 yum install MariaDB-server MariaDB-client
.
在我的.cnf中,我设置pid位置如下:
[mysqld_safe]
pid-file=/var/run/mariadb/mariadb.pid
我可以登录到mariadb,并且error-log中没有错误。但是我找不到 /var/run/mariadb/mariadb.pid
.
连我都碰了 /var/run/mariadb/mariadb.pid
以及 chown mysql:mysql
,里面什么都没有 /var/run/mariadb/mariadb.pid
.
根据olegsv的回答,pid位置是 /var/lib/mysql/localhost.pid
```
MariaDB [(none)]> show variables like '%pid%';
+---------------+------------------------------+
| Variable_name | Value |
+---------------+------------------------------+
| pid_file | /var/lib/mysql/localhost.pid |
+---------------+------------------------------+
1 row in set (0.001 sec)
根据里克·詹姆斯的回答,我搬家了 `pid-file=/var/run/mariadb/mariadb.pid` 至 `[mysqld]` 以及 `systemctl restart mariadb` ,我发现mariadb无法重新启动,错误信息如下:
[root@localhost my.cnf.d]# systemctl status mariadb -l
● mariadb.service - MariaDB 10.3.10 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 Sun 2018-10-21 1:10:12 UTC; 30s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1502 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1610 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 1517 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: 1515 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 1610 (code=exited, status=1/FAILURE)
Oct 21 1:10:12 localhost.localdomain systemd[1]: Starting MariaDB 10.3.10 database server...
Oct 21 1:10:12 localhost.localdomain mysqld[1610]: 2018-10-21 1:10:12 0 [Note] /usr/sbin/mysqld (mysqld 10.3.10-MariaDB-log) starting as process 1610 ...
Oct 21 1:10:12 localhost.localdomain systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Oct 21 1:10:12 localhost.localdomain systemd[1]: Failed to start MariaDB 10.3.10 database server.
Oct 21 1:10:12 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Oct 21 1:10:12 localhost.localdomain systemd[1]: mariadb.service failed.
以及:
[root@localhost my.cnf.d]# journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has begun shutting down.
Oct 21 1:10:12 localhost.localdomain systemd[1]: Starting MariaDB 10.3.10 datab
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has begun starting up.
Oct 21 1:10:12 localhost.localdomain mysqld[1610]: 2018-10-21 1:10:12 0 [Note]
Oct 21 1:10:12 localhost.localdomain systemd[1]: mariadb.service: main process
Oct 21 1:10:12 localhost.localdomain systemd[1]: Failed to start MariaDB 10.3.1
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has failed.
-- The result is failed.
Oct 21 1:10:12 localhost.localdomain systemd[1]: Unit mariadb.service entered f
Oct 21 1:10:12 localhost.localdomain systemd[1]: mariadb.service failed.
Oct 21 1:10:12 localhost.localdomain polkitd[601]: Unregistered Authentication
如何改变mariadb 10.3的pid位置?
2条答案
按热度按时间webghufk1#
在
my.cnf
(或无论配置文件在哪里),添加[mysqld]
章节:iq0todco2#
从mariadb客户端提示: