Debian 9:从 8 升级后,MySQL (MariaDB) 不再工作

Debian 9:从 8 升级后,MySQL (MariaDB) 不再工作

我刚刚从 Debian 8 升级到 9。

显然,它破坏了与数据库相关的所有内容。我现在无法启动MySQL,错误是:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

服务状态:

systemctl status mariadb.service

显示错误:

● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-02-02 16:55:27 AEST; 35s ago
  Process: 6859 ExecStartPost=/etc/mysql/debian-start (code=exited, status=203/EXEC)
  Process: 6832 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 6821 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 6815 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 6814 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
 Main PID: 6832 (code=exited, status=0/SUCCESS)
   Status: "MariaDB server is down"

2 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] /usr/sbin/mysqld: Normal shutdown
2 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] Event Scheduler: Purging the queue. 0 events
2 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140494621349632 [Note] InnoDB: FTS optimize thread exiting.
2 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] InnoDB: Starting shutdown...
2 02 16:55:26 doraemoe mysqld[6832]: 2018-02-02 16:55:26 140495303359232 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2 02 16:55:27 doraemoe mysqld[6832]: 2018-02-02 16:55:27 140495303359232 [Note] InnoDB: Shutdown completed; log sequence number 1616889
2 02 16:55:27 doraemoe mysqld[6832]: 2018-02-02 16:55:27 140495303359232 [Note] /usr/sbin/mysqld: Shutdown complete
2 02 16:55:27 doraemoe systemd[1]: Failed to start MariaDB database server.
2 02 16:55:27 doraemoe systemd[1]: mariadb.service: Unit entered failed state.
2 02 16:55:27 doraemoe systemd[1]: mariadb.service: Failed with result 'exit-code'.

另一种获取信息的方法:

journalctl -xe` that maybe useful: `2 02 16:42:39 doraemoe systemd[5505]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No such file or directory

我如何解决它?

编辑:这是完整的输出journalctl -u mariadb.service

Logs begin at Fri 2018-02-02 16:36:33 AEST, end at Fri 2018-02-02 19:05:01 AEST. 
2月 02 16:36:35 doraemoe systemd[1]: Starting MariaDB database server...
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 3534 ...
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [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.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: The InnoDB memory heap is disabled
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Compressed tables use zlib 1.2.8
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Using Linux native AIO
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Using SSE crc32 instructions
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Completed initialization of buffer pool
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Highest supported file format is Barracuda.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: 128 rollback segment(s) are active.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB: Waiting for purge to start
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.1 started; log sequence number 1616859
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] Plugin 'FEEDBACK' is disabled.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] Server socket created on IP: '::'.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139855396824832 [Note] InnoDB: Dumping buffer pool(s) not yet started
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856107147840 [Note] /usr/sbin/mysqld: ready for connections.
2月 02 16:36:36 doraemoe mysqld[3534]: Version: '10.1.26-MariaDB-0+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 9.1
2月 02 16:36:36 doraemoe systemd[3810]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No such file or directory
2月 02 16:36:36 doraemoe systemd[1]: mariadb.service: Control process exited, code=exited status=203
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856106375936 [Note] /usr/sbin/mysqld: Normal shutdown
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856106375936 [Note] Event Scheduler: Purging the queue. 0 events
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139855422002944 [Note] InnoDB: FTS optimize thread exiting.
2月 02 16:36:36 doraemoe mysqld[3534]: 2018-02-02 16:36:36 139856106375936 [Note] InnoDB: Starting shutdown...
2月 02 16:36:37 doraemoe mysqld[3534]: 2018-02-02 16:36:37 139856106375936 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2月 02 16:36:39 doraemoe mysqld[3534]: 2018-02-02 16:36:39 139856106375936 [Note] InnoDB: Shutdown completed; log sequence number 1616869
2月 02 16:36:39 doraemoe mysqld[3534]: 2018-02-02 16:36:39 139856106375936 [Note] /usr/sbin/mysqld: Shutdown complete
2月 02 16:36:39 doraemoe systemd[1]: Failed to start MariaDB database server.
2月 02 16:36:39 doraemoe systemd[1]: mariadb.service: Unit entered failed state.
2月 02 16:36:39 doraemoe systemd[1]: mariadb.service: Failed with result 'exit-code'.
2月 02 16:42:39 doraemoe systemd[1]: Starting MariaDB database server...
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 5478 ...
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [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.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: The InnoDB memory heap is disabled
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Compressed tables use zlib 1.2.8
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Using Linux native AIO
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Using SSE crc32 instructions
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Completed initialization of buffer pool
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Highest supported file format is Barracuda.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: 128 rollback segment(s) are active.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB: Waiting for purge to start
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.1 started; log sequence number 1616869
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] Plugin 'FEEDBACK' is disabled.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140596496787200 [Note] InnoDB: Dumping buffer pool(s) not yet started
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] Server socket created on IP: '::'.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597204075072 [Note] /usr/sbin/mysqld: ready for connections.
2月 02 16:42:39 doraemoe mysqld[5478]: Version: '10.1.26-MariaDB-0+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 9.1
2月 02 16:42:39 doraemoe systemd[5505]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No such file or directory
2月 02 16:42:39 doraemoe systemd[1]: mariadb.service: Control process exited, code=exited status=203
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597203303168 [Note] /usr/sbin/mysqld: Normal shutdown
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597203303168 [Note] Event Scheduler: Purging the queue. 0 events
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140596521965312 [Note] InnoDB: FTS optimize thread exiting.
2月 02 16:42:39 doraemoe mysqld[5478]: 2018-02-02 16:42:39 140597203303168 [Note] InnoDB: Starting shutdown...
2月 02 16:42:40 doraemoe mysqld[5478]: 2018-02-02 16:42:40 140597203303168 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2月 02 16:42:42 doraemoe mysqld[5478]: 2018-02-02 16:42:42 140597203303168 [Note] InnoDB: Shutdown completed; log sequence number 1616879
2月 02 16:42:42 doraemoe mysqld[5478]: 2018-02-02 16:42:42 140597203303168 [Note] /usr/sbin/mysqld: Shutdown complete
2月 02 16:42:42 doraemoe systemd[1]: Failed to start MariaDB database server.
2月 02 16:42:42 doraemoe systemd[1]: mariadb.service: Unit entered failed state.
2月 02 16:42:42 doraemoe systemd[1]: mariadb.service: Failed with result 'exit-code'.
2月 02 16:55:24 doraemoe systemd[1]: Starting MariaDB database server...
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 6832 ...
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [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.
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: The InnoDB memory heap is disabled
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Compressed tables use zlib 1.2.8
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Using Linux native AIO
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Using SSE crc32 instructions
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Completed initialization of buffer pool
2月 02 16:55:24 doraemoe mysqld[6832]: 2018-02-02 16:55:24 140495304131136 [Note] InnoDB: Highest supported file format is Barracuda.
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] InnoDB: 128 rollback segment(s) are active.
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] InnoDB: Waiting for purge to start
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.1 started; log sequence number 1616879
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] Plugin 'FEEDBACK' is disabled.
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140494596171520 [Note] InnoDB: Dumping buffer pool(s) not yet started
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] Server socket created on IP: '::'.
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495304131136 [Note] /usr/sbin/mysqld: ready for connections.
2月 02 16:55:25 doraemoe mysqld[6832]: Version: '10.1.26-MariaDB-0+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 9.1
2月 02 16:55:25 doraemoe systemd[6859]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No such file or directory
2月 02 16:55:25 doraemoe systemd[1]: mariadb.service: Control process exited, code=exited status=203
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] /usr/sbin/mysqld: Normal shutdown
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] Event Scheduler: Purging the queue. 0 events
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140494621349632 [Note] InnoDB: FTS optimize thread exiting.
2月 02 16:55:25 doraemoe mysqld[6832]: 2018-02-02 16:55:25 140495303359232 [Note] InnoDB: Starting shutdown...
2月 02 16:55:26 doraemoe mysqld[6832]: 2018-02-02 16:55:26 140495303359232 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2月 02 16:55:27 doraemoe mysqld[6832]: 2018-02-02 16:55:27 140495303359232 [Note] InnoDB: Shutdown completed; log sequence number 1616889
2月 02 16:55:27 doraemoe mysqld[6832]: 2018-02-02 16:55:27 140495303359232 [Note] /usr/sbin/mysqld: Shutdown complete
2月 02 16:55:27 doraemoe systemd[1]: Failed to start MariaDB database server.
2月 02 16:55:27 doraemoe systemd[1]: mariadb.service: Unit entered failed state.
2月 02 16:55:27 doraemoe systemd[1]: mariadb.service: Failed with result 'exit-code'.

运行/etc/init.d/mysql start结果:

[....] Starting mysql (via systemctl): mysql.serviceJob for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
 failed!

我找不到名为的文件mysql.err,也ps -aux|grep -i maria没有产生任何结果。

答案1

由于某种原因,您没有该文件/etc/mysql/debian-start,这是给出的错误:

16:55:25 doraemoe systemd[6859]: mariadb.service: Failed at step EXEC spawning /etc/mysql/debian-start: No such file or directory

我已经检查了我的安装mariadb,该文件是mariadb-server-10.1软件包的一部分。检查是否有/etc/mysql/debian-start.dpkg-dist或类似,如果有则将其重命名为/etc/mysql/debian-start.

否则,请检查您安装的确切包名称:

dpkg -S /usr/bin/mysqld_safe

mariadb-server-10.1: /usr/bin/mysqld_safe

下载软件包 .deb(例如通过此页面),解压它:

dpkg-deb --extract mariadb-server-10.1_10.1.26-0+deb9u1_amd64.deb /tmp/mariadb-server

(替换您下载的文件的名称)然后复制该文件:

cp /tmp/mariadb-server/etc/mysql/debian-start /etc/mysql/

然后您应该能够启动它;除非还有更多文件丢失。奇怪的是,这个文件应该丢失了,所以在某个阶段出了问题。

答案2

尝试一下systemctl start mysqld

[root@server ~]# systemctl status mysqld
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-12-02 13:39:38 CET; 2 months 1 days ago
 Main PID: 31087 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           └─31087 /usr/sbin/mysqld

Dez 02 13:39:37 h2730855 systemd[1]: Starting MariaDB database server...
Dez 02 13:39:37 h2730855 mysqld[31087]: 2017-12-02 13:39:37 140401666978368 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 31087 
Dez 02 13:39:38 h2730855 systemd[1]: Started MariaDB database server.

相关内容