Linux Antergos 安装 MySql

Linux Antergos install MySql

我一直在尝试在 Linux Antergos 上安装 Apache 和 MySQL。不幸的是,安装MySQL(pacman -S mysql)后,无法启动该服务。我想知道出了什么问题。 pacmanerror: target not found: mysql

Start mysql (sudo systemctl start mysqld) returns:
Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.


sudo 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 Tue 2015-08-04 17:16:21 CEST; 18s ago
  Process: 6496 ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
 Main PID: 6496 (code=exited, status=1/FAILURE);         : 6497 (mysqld-post)
   CGroup: /system.slice/mysqld.service
           └─control
             ├─6497 /bin/sh /usr/bin/mysqld-post
             └─6639 sleep 1

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

非常感谢任何帮助,在此先感谢。

您发布的错误描述性不强,但至少我们可以看到可能存在权限错误。 检查 /var/lib/mysql 是否为 mysql 用户的 rwx,并且里面的文件对于 mysql 用户 and/or 组至少是 rw-。

你可以用ls -l /var/lib/mysql/查看 您可以通过发出

来更改文件所有权
sudo chown mysql:mysql -R /var/lib/mysql

*首先检查 user/group 是否被调用 mysql 否则它会失败

查看守护进程是否在 systemctl 日志之外进行日志记录(如果它正在这样做,您很可能会在 mysql 目录中找到 mysql.err,但如果权限错误它可能根本无法在那里登录)