Fail to start Mariadb server (code=killed) - mysql

I have a problem with my mariadb server on debian : it used to work, but not anymore. When I try to start it, I have this error :
-- L'unité (unit) mariadb.service a commencé à démarrer.
juin 28 16:05:30 p2node-g1-petitecolo mysqld[665649]: 2020-06-28 16:05:30 140370356227456 [Note] /usr/sbin/mysqld (mysqld 10.1.41-MariaDB-0+deb9u1) starting as process 665649 ...
juin 28 16:05:31 p2node-g1-petitecolo systemd[1]: Started MariaDB 10.1.41 database server.
-- Subject: L'unité (unit) mariadb.service a terminé son démarrage
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a terminé son démarrage, avec le résultat done.
juin 28 19:05:23 p2node-g1-petitecolo systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL
juin 28 19:05:23 p2node-g1-petitecolo systemd[1]: mariadb.service: Unit entered failed state.
juin 28 19:05:23 p2node-g1-petitecolo systemd[1]: mariadb.service: Failed with result 'signal'.
juin 28 19:05:28 p2node-g1-petitecolo systemd[1]: mariadb.service: Service hold-off time over, scheduling restart.
juin 28 19:05:28 p2node-g1-petitecolo systemd[1]: Stopped MariaDB 10.1.41 database server.
-- Subject: L'unité (unit) mariadb.service a terminé son arrêt
And
> sudo service mysql status
● mariadb.service - MariaDB 10.1.41 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: signal) since Mon 2020-07-06 09:37:26 CEST; 4s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 991549 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 991545 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Process: 2379279 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal=KILL)
Process: 2379204 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=ex
Process: 2379202 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 2379201 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 2379279 (code=killed, signal=KILL)
Any idea of why I have a code=killed ??
Thanks for your help !

Related

Transfering MySQL data from one system to the other

I've got all my files from my last MySQL(MariaDB InnoDB) Server and I just noticed I can't run those files on my new system. I don't have any .SQL backup of my server and my old system can't be booted to as far as I know.
I moved from Ubuntu Server 18.04 to CentOS 7 (and a RAID1 configuration), I cloned my original Ubuntu drive to a secondary drive.
Here are the files that I moved from my Ubuntu drive
/var/lib/mysql/ Files
[root#localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.2.32 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 Thu 2020-07-09 20:20:46 PDT; 26s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 3281 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS --basedir=/usr $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 3132 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: 3129 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 3281 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
Jul 09 20:20:46 localhost.localdomain systemd[1]: Starting MariaDB 10.2.32 database server...
Jul 09 20:20:46 localhost.localdomain mysqld[3281]: 2020-07-09 20:20:46 140603055900864 [Note] /usr/sbin/mysqld (mysqld 10.2.32-MariaDB-log) starting as process 3281 ...
Jul 09 20:20:46 localhost.localdomain mysqld[3281]: 2020-07-09 20:20:46 140603055900864 [Warning] Can't create test file /media/1TB/var/lib/mysql/localhost.lower-test
Jul 09 20:20:46 localhost.localdomain mysqld[3281]: [107B blob data]
Jul 09 20:20:46 localhost.localdomain mysqld[3281]: 2020-07-09 20:20:46 140603055900864 [ERROR] Aborting
Jul 09 20:20:46 localhost.localdomain systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Jul 09 20:20:46 localhost.localdomain systemd[1]: Failed to start MariaDB 10.2.32 database server.
Jul 09 20:20:46 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Jul 09 20:20:46 localhost.localdomain systemd[1]: mariadb.service failed.
I'm not sure what I'm missing and why it won't start, I wish I would have kept the other system to export a SQL file which would have made my life so much easier.

Failed to start MariaDB 10.2.16 database server

When I have entered systemctl status mariadb.service
The output is:
mariadb.service - MariaDB 10.2.16 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Tue 2018-07-17 13:53:46 +06; 24s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 7342 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 7058 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && system
Process: 7054 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 7052 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 7342 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
Jul 17 13:53:43 munim-Inspiron-5548 systemd[1]: Starting MariaDB 10.2.16 database server...
Jul 17 13:53:43 munim-Inspiron-5548 mysqld[7342]: 2018-07-17 13:53:43 139955312822464 [Note] /usr/sbin/mysqld (mysqld 10.2.16-MariaDB-10.2.16+m
Jul 17 13:53:46 munim-Inspiron-5548 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 17 13:53:46 munim-Inspiron-5548 systemd[1]: Failed to start MariaDB 10.2.16 database server.
Jul 17 13:53:46 munim-Inspiron-5548 systemd[1]: mariadb.service: Unit entered failed state.
Jul 17 13:53:46 munim-Inspiron-5548 systemd[1]: mariadb.service: Failed with result 'exit-code'.
I have tried to login mysql -u root -p it shows
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Can anyone give me any suggestion?

Error: Trying to do i/o to a tablespace which exists without .ibd data file

I can't restart my mariadb server because I'm getting this error message and I ran systemctl status mariadb.service -l to see the full error message but it doesn't tell me what table and where the table can be found so I'm completely lost.
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
└─limits.conf, migrated-from-my.cnf-settings.conf
Active: activating (auto-restart) (Result: signal) since Thu 2017-04-06 10:55:41 EDT; 4s ago
Process: 2324 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal=ABRT)
Process: 2202 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: 2199 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 2324 (code=killed, signal=ABRT)
Status: "InnoDB: Error: Trying to do i/o to a tablespace which exists without .ibd data file. i/o type 10, space id 840720, page no 0, i/o length 16384 bytes"
CGroup: /system.slice/mariadb.service
Apr 06 10:55:41 www.ooples.com systemd[1]: Failed to start MariaDB database server.
Apr 06 10:55:41 www.ooples.com systemd[1]: Unit mariadb.service entered failed state.
Apr 06 10:55:41 www.ooples.com systemd[1]: mariadb.service failed.
This error was caused by an orphaned idb file in the /var/lib/mysql/database_name folder and I deleted the ibd file and I was able to start the mysql server

Can't start mysql server

After rebooting server, I can't start mysql again
I received this message:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
I tried journalctl -xe and received this
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Unit entered failed state.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 06 21:25:57 myserver systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 06 21:25:57 myserver systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 06 21:25:57 myserver systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 06 21:25:58 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
here is the result for systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Sun 2016-11-06 21:29:00 UTC; 21s ago
Process: 4563 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 4560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 4563 (code=exited, status=1/FAILURE); : 4566 (mysql-systemd-s)
Tasks: 2
Memory: 320.0K
CPU: 400ms
CGroup: /system.slice/mysql.service
└─control
├─4566 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─4625 sleep 1
Nov 06 21:29:00 myserver systemd[1]: Starting MySQL Community Server...
Nov 06 21:29:01 myserver systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Please help ! Thank you!
I found out the solution after checking mysql error.log
The disk was full.

Error when trying to use tmpfs for MySQL in Vagrant

I have a Vagrant machine to run Symfony and it does a lot of interaction with a MySQL database. To try to speed it up a little bit I though about using a tmpfs file system for the data dir.
The data dir is located at /var/lib/mysql, so here's what I tried:
1) stop the mysql service: sudo service mysql stop
2) mount the tmpfs: sudo mount -t tmpfs -o size=512M tmpfs /var/lib/mysql
3) start mysql: sudo service mysql start
And then I get the following error:
Job for mysql.service failed. See "systemctl status mysql.service" and "journalctl -xe" for details.
systemctl status mysql.service output is:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit) since Tue 2016-04-05 20:30:52 UTC; 1min 58s ago
Process: 3376 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 3375 ExecStart=/usr/bin/mysqld_safe (code=exited, status=0/SUCCESS)
Process: 3839 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 3375 (code=exited, status=0/SUCCESS)
Apr 05 20:30:52 libe systemd[1]: mysql.service holdoff time over, scheduling restart.
Apr 05 20:30:52 libe systemd[1]: start request repeated too quickly for mysql.service
Apr 05 20:30:52 libe systemd[1]: Failed to start MySQL Community Server.
Apr 05 20:30:52 libe systemd[1]: Unit mysql.service entered failed state.
Apr 05 20:30:52 libe systemd[1]: mysql.service failed.
Which doesn't give too much information... Any ideas on how to debug this or what I'm doing wrong? Thanks!