Я создаю дополнительный экземпляр MySQL, и при запуске получаю ошибку и, возможно, небольшой сбой при инициализации.
Raspberry/Debian предпочитает размещать файлы в разных местах, которые вы видите в других руководствах/документации. Хорошо, начнем:
Владельцем всех файлов является mysql, а не root. Именно так поступали мои первоначальные phpmyadmin и mariadb, и я придерживаюсь этого.
| Создание нового служебного файла и изменение разрешений:
Код: Выделить всё
sudo touch /etc/systemd/system/mysqld@.service
sudo chown -v -R mysql:mysql /etc/systemd/system/mysqld@.service
Код: Выделить всё
[Unit]
Description=MySQL Multi Server for instance %i
After=syslog.target
After=network.target
[Service]
User=mysql
Group=mysql
Type=forking
ExecStart=/usr/bin/mysqld_multi start %i
ExecStop=/usr/bin/mysqld_multi stop %i
Restart=always
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Код: Выделить всё
sudo mkdir -p -v /var/lib/mysql_FL
sudo mkdir -p -v /var/run/mysqld/mysql_FL
sudo mkdir -p -v /var/log/mysql_FL
sudo chown mysql:mysql -v /var/lib/mysql_FL
sudo chown mysql:mysql -v /var/run/mysqld/mysql_FL
sudo chown -v -R mysql:mysql /var/log/mysql_FL
sudo touch /var/log/mysql_FL/mysql_FL.log
sudo chown -v -R mysql:mysql /var/log/mysql_FL/mysql_FL.log
Код: Выделить всё
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe --basedir=/usr
[mysql_FL]
port=3307
datadir=/var/lib/mysql_FL
socket=/var/run/mysqld/mysql_FL/mysql.sock
pid-file=/var/run/mysqld/mysql_FL/mysqld1.pid
log-error=/var/log/mysql_FL/mysql_FL.log
# Disabling symbolic-links is recommended to prevent assorted security
# risks
symbolic-links=0
Код: Выделить всё
sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql_FL/
Installing MariaDB/MySQL system tables in '/var/lib/mysql_FL/' ...
2025-01-06 3:51:04 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
OK
To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mariadb-safe --datadir='/var/lib/mysql_FL/'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/share/mysql/mysql-test' ; perl mariadb-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
| Запуск экземпляра:
Код: Выделить всё
sudo systemctl start mysqld@mysql_FL
Job for mysqld@mysql_FL.service failed because the control process exited with error code.
See "systemctl status mysqld@mysql_FL.service" and "journalctl -xeu mysqld@mysql_FL.service" for details.
Код: Выделить всё
systemctl status mysqld@mysql_FL.service
× mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL
Loaded: loaded (/etc/systemd/system/mysqld@.service; disabled; preset: enabled)
Active: failed (Result: exit-code) since Mon 2025-01-06 04:26:37 CET; 1min 28s ago
Process: 6993 ExecStart=/usr/bin/mysqld_multi start mysql_FL (code=exited, status=13)
CPU: 39ms
Jan 06 04:26:37 raspberrypi systemd[1]: Failed to start mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL.
Jan 06 04:26:37 raspberrypi systemd[1]: mysqld@mysql_FL.service: Scheduled restart job, restart counter is at 5.
Jan 06 04:26:37 raspberrypi systemd[1]: Stopped mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL.
Jan 06 04:26:37 raspberrypi systemd[1]: mysqld@mysql_FL.service: Start request repeated too quickly.
Jan 06 04:26:37 raspberrypi systemd[1]: mysqld@mysql_FL.service: Failed with result 'exit-code'.
Jan 06 04:26:37 raspberrypi systemd[1]: Failed to start mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL.
Код: Выделить всё
journalctl -xeu mysqld@mysql_FL.service
Jan 06 04:11:29 raspberrypi systemd[1]: Stopped mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL.
░░ Subject: A stop job for unit mysqld@mysql_FL.service has finished
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A stop job for unit mysqld@mysql_FL.service has finished.
░░
░░ The job identifier is 4642 and the job result is done.
Jan 06 04:11:29 raspberrypi systemd[1]: mysqld@mysql_FL.service: Start request repeated too quickly.
Jan 06 04:11:29 raspberrypi systemd[1]: mysqld@mysql_FL.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit mysqld@mysql_FL.service has entered the 'failed' state with result 'exit-code'.
Jan 06 04:11:29 raspberrypi systemd[1]: Failed to start mysqld@mysql_FL.service - MySQL Multi Server for instance mysql_FL.
░░ Subject: A start job for unit mysqld@mysql_FL.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mysqld@mysql_FL.service has finished with a failure.
░░
░░ The job identifier is 4642 and the job result is failed.
lines 223-245/245 (END)
Спасибо вам большое!
Подробнее здесь: https://stackoverflow.com/questions/793 ... n-starting
Мобильная версия