0

由于后端应用程序,我需要 MariaDB 5.5.68。我已经安装了 CentOS Web 面板,之后用 yum remove mariadbyum remove MariaDB-commonrm -rf /var/lib/mysql. rm /etc/my.cnf我已经安装了 MariaDB 5.5.68。

现在的问题是,当我写 mysql 时,我得到了这个错误:

"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)".


[root@server720546 ~]# systemctl start mariadb  

Failed to start mariadb.service: Unit not found.

更新

[root@server720546 mariadb]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: failed (Result: exit-code) since Sat 2021-08-07 14:22:22 UTC; 5min ago
  Process: 1672 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 1671 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 1637 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 1671 (code=exited, status=0/SUCCESS)

Aug 07 14:22:21 server720546.cloudsons.net systemd[1]: Starting MariaDB database server...
Aug 07 14:22:21 server720546.cloudsons.net mariadb-prepare-db-dir[1637]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Aug 07 14:22:21 server720546.cloudsons.net mysqld_safe[1671]: 210807 14:22:21 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 07 14:22:21 server720546.cloudsons.net mysqld_safe[1671]: 210807 14:22:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 07 14:22:22 server720546.cloudsons.net systemd[1]: mariadb.service: control process exited, code=exited status=1
Aug 07 14:22:22 server720546.cloudsons.net systemd[1]: Failed to start MariaDB database server.
Aug 07 14:22:22 server720546.cloudsons.net systemd[1]: Unit mariadb.service entered failed state.
Aug 07 14:22:22 server720546.cloudsons.net systemd[1]: mariadb.service failed.

来自 mariadb.log:


210807 14:22:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
210807 14:22:21 [Note] /usr/libexec/mysqld (mysqld 5.5.68-MariaDB) starting as process 1836 ...
210807 14:22:21 InnoDB: The InnoDB memory heap is disabled
210807 14:22:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
210807 14:22:21 InnoDB: Compressed tables use zlib 1.2.7
210807 14:22:21 InnoDB: Using Linux native AIO
210807 14:22:21 InnoDB: Initializing buffer pool, size = 128.0M
210807 14:22:21 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file ./ibdata1
210807 14:22:21 InnoDB: Could not open or create data files.
210807 14:22:21 InnoDB: If you tried to add new data files, and it failed here,
210807 14:22:21 InnoDB: you should now edit innodb_data_file_path in my.cnf back
210807 14:22:21 InnoDB: to what it was, and remove the new ibdata files InnoDB created
210807 14:22:21 InnoDB: in this failed attempt. InnoDB only wrote those files full of
210807 14:22:21 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
210807 14:22:21 InnoDB: remove old data files which contain your precious data!
210807 14:22:21 [ERROR] Plugin 'InnoDB' init function returned error.
210807 14:22:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
210807 14:22:21 [Note] Plugin 'FEEDBACK' is disabled.
210807 14:22:21 [ERROR] Unknown/unsupported storage engine: InnoDB
210807 14:22:21 [ERROR] Aborting

210807 14:22:21 [Note] /usr/libexec/mysqld: Shutdown complete

210807 14:22:21 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

更新 2

使用 journalctl -xe 我有这个:

[root@server720546 ~]# journalctl -xe
--
-- The start-up result is done.
Aug 07 14:52:05 server720546.cloudsons.net systemd[1]: Started Session 6 of user
-- Subject: Unit session-6.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-6.scope has finished starting up.
--
-- The start-up result is done.
Aug 07 14:52:05 server720546.cloudsons.net systemd-logind[482]: New session 6 of
-- Subject: A new session 6 has been created for user root
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
--
-- A new session with the ID 6 has been created for the user root.
--
-- The leading process of the session is 2394.
Aug 07 14:52:05 server720546.cloudsons.net sshd[2394]: pam_unix(sshd:session): s
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Failed password for root
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Received disconnect from
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Disconnected from 198.23.
lines 1206-1228/1228 (END)
--
-- The start-up result is done.
Aug 07 14:52:05 server720546.cloudsons.net systemd[1]: Started Session 6 of user root.
-- Subject: Unit session-6.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-6.scope has finished starting up.
--
-- The start-up result is done.
Aug 07 14:52:05 server720546.cloudsons.net systemd-logind[482]: New session 6 of user root.
-- Subject: A new session 6 has been created for user root
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
--
-- A new session with the ID 6 has been created for the user root.
--
-- The leading process of the session is 2394.
Aug 07 14:52:05 server720546.cloudsons.net sshd[2394]: pam_unix(sshd:session): session opened for user root by (uid=0)
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Failed password for root from 198.23.233.28 port 57126 ssh2
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Received disconnect from 198.23.233.28 port 57126:11: Bye Bye [preauth]
Aug 07 14:52:06 server720546.cloudsons.net sshd[2396]: Disconnected from 198.23.233.28 port 57126 [preauth]

4

0 回答 0