Mysql

安裝後無法啟動mysql

  • July 17, 2017

我正在嘗試使用此處的指南在我的 Manjaro Linux 機器上安裝 Wordpress,但我遇到了 mysql 問題,它安裝正常,但是當我嘗試啟動它時出現以下錯誤

sudo systemctl start mysqld
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

.

  journalctl -xe
   -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
   -- 
   -- Unit mariadb.service has begun starting up.
   Jul 14 20:42:35 mysqld[27759]: 2017-07-14 20:42:35 140483429396416 [Note] /usr/bin/mysqld (mysqld 10.1.24-Mari
   Jul 14 20:42:35 mysqld[27759]: 2017-07-14 20:42:35 140483429396416 [Warning] Can't create test file /var/lib/mysql/MyPC.lower-test
   Jul 14 20:42:35 mysqld[27759]: [89B blob data]
   Jul 14 20:42:35 mysqld[27759]: 2017-07-14 20:42:35 140483429396416 [ERROR] Aborting
   Jul 14 20:42:35 sudo[27697]: pam_unix(sudo:session): session closed for user root
   Jul 14 20:42:35 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
   Jul 14 20:42:35 systemd[1]: Failed to start MariaDB database server.
   -- Subject: Unit mariadb.service has failed
   -- Defined-By: systemd
   -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
   -- 
   -- Unit mariadb.service has failed.
   -- 
   -- The result is failed.
   Jul 14 20:42:35 systemd[1]: mariadb.service: Unit entered failed state.
   Jul 14 20:42:35 systemd[1]: mariadb.service: Failed with result 'exit-code'.

.

   systemctl status mariadb.service
● mariadb.service - MariaDB database server
  Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Fri 2017-07-14 20:42:35 CDT; 13min ago
 Process: 27759 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAIL
 Process: 27705 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -
 Process: 27700 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 27759 (code=exited, status=1/FAILURE)
  Status: "MariaDB server is down"

Jul 14 20:42:34 systemd[1]: Starting MariaDB database server...
Jul 14 20:42:35 mysqld[27759]: 2017-07-14 20:42:35 140483429396416 [Note] /usr/bin/mysqld (mysqld 10.1.24-Mari
Jul 14 20:42:35 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 20:42:35 systemd[1]: Failed to start MariaDB database server.
Jul 14 20:42:35 systemd[1]: mariadb.service: Unit entered failed state.
Jul 14 20:42:35 systemd[1]: mariadb.service: Failed with result 'exit-code'.

. 我不確定出了什麼問題或如何進行。

新的東西:

:26 140676675801024 [Note] /usr/bin/mysqld (mysqld 10.1.24-MariaDB) starting as process 15628 ...
:26 140676675801024 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool si
:26 140676675801024 [Note] InnoDB: Using mutexes to ref count buffer pool pages
:26 140676675801024 [Note] InnoDB: The InnoDB memory heap is disabled
:26 140676675801024 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
:26 140676675801024 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
:26 140676675801024 [Note] InnoDB: Compressed tables use zlib 1.2.11
:26 140676675801024 [Note] InnoDB: Using Linux native AIO
:26 140676675801024 [Note] InnoDB: Using SSE crc32 instructions
:26 140676675801024 [Note] InnoDB: Initializing buffer pool, size = 128.0M
:26 140676675801024 [Note] InnoDB: Completed initialization of buffer pool
:26 140676675801024 [Note] InnoDB: Highest supported file format is Barracuda.
:26 140676675801024 [Note] InnoDB: 128 rollback segment(s) are active.
:26 140676675801024 [Note] InnoDB: Waiting for purge to start
:26 140676675801024 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.0 started; log sequence number 1600709
:26 140676675801024 [Note] Plugin 'FEEDBACK' is disabled.
:26 140676069496576 [Note] InnoDB: Dumping buffer pool(s) not yet started
:26 140676675801024 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
:26 140676675738368 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist
:26 140676675801024 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
:26 140676675801024 [Note] Server socket created on IP: '::'.
:26 140676675801024 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 98: Address already in use
:26 140676675801024 [ERROR] Do you already have another mysqld server running on port: 3306 ?
:26 140676675801024 [ERROR] Aborting
Jul 16 21:12:29 MyPc systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 16 21:12:29 MyPc systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mariadb.service has failed.
-- 
-- The result is failed.
Jul 16 21:12:29 MyPc systemd[1]: mariadb.service: Unit entered failed state.
Jul 16 21:12:29 MyPc systemd[1]: mariadb.service: Failed with result 'exit-code'.
lines 3172-3190/3190 (END)

更多東西:

:39 139642281652160 [Note] /usr/bin/mysqld (mysqld 10.1.24-MariaDB) starting as process 17168 ...
:39 139642281652160 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool si
:39 139642281652160 [Note] InnoDB: Using mutexes to ref count buffer pool pages
:39 139642281652160 [Note] InnoDB: The InnoDB memory heap is disabled
:39 139642281652160 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
:39 139642281652160 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
:39 139642281652160 [Note] InnoDB: Compressed tables use zlib 1.2.11
:39 139642281652160 [Note] InnoDB: Using Linux native AIO
:39 139642281652160 [Note] InnoDB: Using SSE crc32 instructions
:39 139642281652160 [Note] InnoDB: Initializing buffer pool, size = 128.0M
:39 139642281652160 [Note] InnoDB: Completed initialization of buffer pool
:39 139642281652160 [Note] InnoDB: Highest supported file format is Barracuda.
:39 139642281652160 [Note] InnoDB: 128 rollback segment(s) are active.
:39 139642281652160 [Note] InnoDB: Waiting for purge to start
:39 139642281652160 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.0 started; log sequence number 1600719
:39 139641681639168 [Note] InnoDB: Dumping buffer pool(s) not yet started
:39 139642281652160 [Note] Plugin 'FEEDBACK' is disabled.
:39 139642281652160 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
:39 139642281589504 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_
:39 139642281652160 [Note] /usr/bin/mysqld (mysqld 10.1.24-MariaDB) starting as process 17168 ...
:39 139642281652160 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
:39 139642281652160 [Note] InnoDB: Using mutexes to ref count buffer pool pages
:39 139642281652160 [Note] InnoDB: The InnoDB memory heap is disabled
:39 139642281652160 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
:39 139642281652160 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
:39 139642281652160 [Note] InnoDB: Compressed tables use zlib 1.2.11
:39 139642281652160 [Note] InnoDB: Using Linux native AIO
:39 139642281652160 [Note] InnoDB: Using SSE crc32 instructions
:39 139642281652160 [Note] InnoDB: Initializing buffer pool, size = 128.0M
:39 139642281652160 [Note] InnoDB: Completed initialization of buffer pool
:39 139642281652160 [Note] InnoDB: Highest supported file format is Barracuda.
:39 139642281652160 [Note] InnoDB: 128 rollback segment(s) are active.
:39 139642281652160 [Note] InnoDB: Waiting for purge to start
:39 139642281652160 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.0 started; log sequence number 1600719
:39 139641681639168 [Note] InnoDB: Dumping buffer pool(s) not yet started
:39 139642281652160 [Note] Plugin 'FEEDBACK' is disabled.
:39 139642281652160 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
:39 139642281589504 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist

如果您的數據庫中沒有任何真實數據,請清除所有/var/lib/mysql.

之後再次嘗試執行命令mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql來初始化數據庫目錄。

引用自:https://unix.stackexchange.com/questions/378585