我是数据库的新手,遇到了一些麻烦。我试着用以下命令在运行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.
这种情况发生在重新启动、重新启动服务、重新安装之后,我不知道它出了什么问题。有办法解决吗?
非常感谢。
好的。。。我找到了原因。我从安装了mariadb-server
https://downloads.mariadb.org/mariadb/repositories/#distro=Ubuntu&distro_release=bionic--ubuntubionic&mirror=ustc合肥&版本=10.5,这在我运行ubuntu 18.04的树莓皮4上不起作用。
我从USTC镜像中删除了10.5存储库,从TUNA镜像中添加了10.3版本,并重新安装了mariadb服务器。服务能够成功启动。