【发布时间】:2020-08-10 06:21:42
【问题描述】:
我是数据库新手,遇到了一些麻烦。我尝试使用以下命令在运行 ubuntu 18.04 的 pi4 上重新安装我的 mariadb:
sudo apt remove --purge mysql*
sudo apt autoremove
sudo apt autoclean
它删除了所有与 sql 相关的包。然后我尝试通过以下方式重新安装它们:
sudo apt install libmariadb-dev libmariadb3 mariadb-server
它成功了。但是,当我尝试运行 mysql 时,我得到了:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
然后我通过运行systemctl status mariadb.service 来检查服务状态我得到了:
● 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.
这是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.
这发生在重新启动、重新启动服务、重新安装之后,我不知道它有什么问题。有没有办法解决这个问题?
非常感谢。
【问题讨论】:
-
“systemctl status”日志输出回溯不够远,能否提供
journalctl -u mariadb.service | tail -100的输出?
标签: ubuntu raspberry-pi mariadb