10.5もcent os stream9 appstrem に入っていたものなので本家との違いもあるとは思いますが。
/usr/lib/systemd/system/mariadb@.service
これで mariadb@username という形で複数サービスで利用しているのでこの設定を確認
ちょっと適当なのですが、10.4をみつつ
[Unit] ConditionPathExists=/etc/my.cnf.d/my.%I.cnf
を追記 %I は@以降のユーザー名が入ります。
ExecStartを変更
# ExecStart=/usr/libexec/mariadbd --defaults-group-suffix=.%I --basedir=/usr $MYSQLD_OPTS $_WSREP_NEW_CLUSTER ExecStart=/usr/libexec/mariadbd --defaults-group-suffix=.%I --defaults-file=/etc/my.cnf.d/my.%I.cnf --basedir=/home/%I/data/my --datadir=/home/%I/data/my/data --log-error=/home/%I/log/my-error.log $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
defaults-file , datadir , log-errorを追記。defaults-fileだけでも大丈夫な気もしますが、basedirはなくて大丈夫かな???大丈夫なのかな???というところです。
initailize database
systemd[1]: Starting MariaDB 10.5 database server... mariadb-prepare-db-dir[45913]: Database MariaDB is not initialized, but the directory /home/lobby/data/my/data is not empty, so initialization cannot be done. mariadb-prepare-db-dir[45913]: Make sure the /home/user/data/my/data is empty before running mariadb-prepare-db-dir. systemd[1]: mariadb@lobby.service: Control process exited, code=exited, status=1/FAILURE systemd[1]: mariadb@lobby.service: Failed with result 'exit-code'. systemd[1]: Failed to start MariaDB 10.5 database server.
my以下を chown -R mysql:mysql にして
実行OKでした^^
lobbyという名前でやっているのでこんな状態です。
$ sudo systemctl status mariadb@lobby ● mariadb@lobby.service - MariaDB 10.5 database server Loaded: loaded (/usr/lib/systemd/system/mariadb@.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2022-08-26 12:48:49 EDT; 2min 33s ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 68444 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 10 (limit: 4455) Memory: 69.7M CPU: 250ms CGroup: /system.slice/system-mariadb.slice/mariadb@lobby.service └─68444 /usr/libexec/mariadbd --defaults-group-suffix=.lobby --defaults-file=/etc/my.cnf.d/my.lobby.cnf --basedir=/home/lobby/data/my --datadir=/home/lobby/data/my/data --log-error=/home> 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] InnoDB: 10.5.16 started; log sequence number 45106; transaction id 20 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] Plugin 'FEEDBACK' is disabled. 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] InnoDB: Loading buffer pool(s) from /home/lobby/data/my/data/ib_buffer_pool 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] Server socket created on IP: '::'. 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] InnoDB: Buffer pool(s) load completed at 220826 12:48:49 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] Reading of all Master_info entries succeeded 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] Added new Master_info '' to hash table 8月 26 12:48:49 i-mariadbd[68444]: 2022-08-26 12:48:49 0 [Note] /usr/libexec/mariadbd: ready for connections. 8月 26 12:48:49 i-mariadbd[68444]: Version: '10.5.16-MariaDB' socket: '/home/lobby/data/my/my.socket' port: 29286 MariaDB Server 8月 26 12:48:49 i-systemd[1]: Started MariaDB 10.5 database server.
$ ls -lart /home/lobby/data/my 合計 8 drwxr-xr-x 3 root root 16 8月 22 14:08 .. srwxrwxrwx 1 mysql mysql 0 8月 26 12:48 my.socket -rw-rw---- 1 mysql mysql 6 8月 26 12:48 my.pid drwxrwxrwx 3 mysql mysql 49 8月 26 12:48 . drwxr-xr-x 4 mysql mysql 4096 8月 26 12:48 data
Socketに接続確認
$ mysql -u root -S /home/lobby/data/my/my.socket Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 10.5.16-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type
コメント