Search code examples
mysqllinuxpacman-package-manager

Linux Antergos install MySql


I've been trying to install Apache and MySQL on Linux Antergos. Unfortunately, after installing MySQL (pacman -S mysql), it is not possible to start the service. I wonder what has gone wrong. Efforts to remove the package were in vain as pacman says error: 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

Would be greatfull for any help, thanks in advance.


Solution

  • The error you posted is not too descriptive, but at least we can see there maybe a permissions error. Check that the /var/lib/mysql is rwx for mysql user and the files inside are all at least rw- for the mysql user and/or group.

    You can check it with ls -l /var/lib/mysql/ you can change the files ownership by issuing

    sudo chown mysql:mysql -R /var/lib/mysql
    

    *first check that the user/group is called mysql or it will fail

    Take a look on if the daemon is logging besides the systemctl log (if it is doing so, most probable you will find a mysql.err in your mysql directory, but if permissions are wrong it might not be able to log at all there)