简体   繁体   中英

mariadb.service unable to start after reinstalling mariadb-server

I'm new to database and I had some trouble. I tried to reinstall my mariadb on my pi4 running ubuntu 18.04 with following commands:

sudo apt remove --purge mysql*
sudo apt autoremove
sudo apt autoclean

which removed all sql related packages. Then I tried to reinstall them by:

sudo apt install libmariadb-dev libmariadb3 mariadb-server

and it succeeded. However, when I try to run mysql I got:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

Then I check the service status by running systemctl status mariadb.service I got:

● mariadb.service - MariaDB 10.5.4 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 Sat 2020-07-25 23:03:08 UTC; 7min ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 4080 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Jul 25 23:03:07 ubuntu mariadbd[4080]: 2020-07-25 23:03:07 0 [Note] InnoDB: Starting shutdown...
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [ERROR] Plugin 'InnoDB' init function returned error.
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [Note] Plugin 'FEEDBACK' is disabled.
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jul 25 23:03:08 ubuntu mariadbd[4080]: 2020-07-25 23:03:08 0 [ERROR] Aborting
Jul 25 23:03:08 ubuntu systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 25 23:03:08 ubuntu systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 25 23:03:08 ubuntu systemd[1]: Failed to start MariaDB 10.5.4 database server.

Here is the log output from journalctl -u mariadb.service :

Jul 28 05:06:40 ubuntu systemd[1]: Starting MariaDB 10.5.4 database server...
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] /usr/sbin/mariadbd (mysqld 10.5.4-MariaDB-1:10.5.4+maria~bionic) starting as process 20942 ...
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Warning] Could not increase number of max_open_files to more than 16364 (request: 32186)
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Using Linux native AIO
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Uses event mutexes
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Number of pools: 1
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Using ARMv8 crc32 instructions
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Completed initialization of buffer pool
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [Note] InnoDB: Header page consists of zero bytes in datafile: ./ibdata1, Space ID:0, Flags: 0
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
Jul 28 05:06:40 ubuntu mariadbd[20942]: 2020-07-28  5:06:40 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [Note] InnoDB: Starting shutdown...
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [ERROR] Plugin 'InnoDB' init function returned error.
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [Note] Plugin 'FEEDBACK' is disabled.
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jul 28 05:06:41 ubuntu mariadbd[20942]: 2020-07-28  5:06:41 0 [ERROR] Aborting
Jul 28 05:06:41 ubuntu systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 28 05:06:41 ubuntu systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 28 05:06:41 ubuntu systemd[1]: Failed to start MariaDB 10.5.4 database server.

This happens after reboot, restart service, reinstall and I do not know what is wrong with it. Is there a way to fix this?

Many thanks.

Ok... I found out the reason. I installed mariadb-server from https://downloads.mariadb.org/mariadb/repositories/#distro=Ubuntu&distro_release=bionic--ubuntu_bionic&mirror=ustc-hefei&version=10.5 and that did not work on my raspberry pi 4 running ubuntu 18.04.

I removed the 10.5 repository from USTC mirror and added the 10.3 version from TUNA mirror and reinstalled mariadb-server. The service was able to start successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM