Arch-Linux

無法在 Arch linux 中啟動 mysqld

  • March 3, 2018

我最近安裝了 Arch Linux x64,我想安裝 LAMP 堆棧。一切正常,直到我到達我安裝但無法啟動的 MySQL 部分。的輸出 sudo systemctl start mysqld 給出:

Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

這是systemctl status mysqld.service輸出:

* mysqld.service - MariaDB database server
  Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
  Active: activating (start-post) (Result: exit-code) since Fri 2015-07-17 22:31:04 CET; 20s ago
 Process: 9548 ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Main PID: 9548 (code=exited, status=1/FAILURE);         : 9549 (mysqld-post)
  CGroup: /system.slice/mysqld.service
          `-control
            |-9549 /bin/sh /usr/bin/mysqld-post
            `-9743 sleep 1

Jul 17 22:31:04 sn4k3 systemd[1]: Starting MariaDB database server...
Jul 17 22:31:04 sn4k3 mysqld[9548]: 150717 22:31:04 [Note] /usr/bin/mysqld (mysqld 10.0.20-MariaDB-log) starting as process 9548 ...
Jul 17 22:31:04 sn4k3 mysqld[9548]: 150717 22:31:04 [Warning] Can't create test file /var/lib/mysql/sn4k3.lower-test
Jul 17 22:31:04 sn4k3 mysqld[9548]: [96B blob data]
Jul 17 22:31:04 sn4k3 mysqld[9548]: 150717 22:31:04 [ERROR] Aborting
Jul 17 22:31:04 sn4k3 mysqld[9548]: 150717 22:31:04 [Note] /usr/bin/mysqld: Shutdown complete
Jul 17 22:31:04 sn4k3 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE

找到您只需執行此命令的解決方案:

sudo mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/

來源Archlinux 維基

還要檢查您的分區是否未滿,這是我的情況。

由於未知原因,將數據移動到另一個分區也不起作用。

因此,為了快速修復,我沒有弄亂 llvm 或 gparted,而是減小了/swapfile尺寸。

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