无法在 arch linux 中启动 mysqld

无法在 arch linux 中启动 mysqld

我最近安装了 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

答案1

找到了您只需运行此命令的解决方案:

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

来源:Archlinux 维基

答案2

还要检查您的分区是否未满,这就是我的情况。

由于未知原因,将数据移动到另一个分区也不起作用。

因此,为了快速修复,我没有弄乱 llvm 或 gparted,而是减小了/swapfile大小。

答案3

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

答案4

重新安装 MySQL 可能会有所帮助:

首先卸载当前的MySQL 然后删除/var/lib/mysql 和/etc/mycnf 或/etc/mycng.rpmsave 重新启动机器 现在再次安装MySQL。

相关内容