mysqld_safe does not allow MySQL connection
Question
I cannot start mysqld without getting the following error:
[root@alarm ~]# mysqld
140414 16:01:04 [ERROR] Fatal error: Please read "Security" section of the manua l to find out how to run mysqld as root!
140414 16:01:04 [ERROR] Aborting
140414 16:01:04 [Note] mysqld: Shutdown complete
If I try to start mysql, it tell me it cannot connect to the local mysql server through the socket '/run/mysqld/mysqld.sock'. I fixed this by running mysqld_safe instead of mysqld. This has stopped working and I now get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mys qld/mysqld.sock' (2)
I use mariadb on the Archlinux distribution. Anyone know how to fix this?
EDIT 1:
Steve, I managed to start the mysqld service by using systemctl as can be seen here:
[root@alarm ~]# ps aux | grep mysql
mysql 880 1.0 10.3 514276 52776 ? Ssl 09:30 0:01 /usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid
root 1618 0.0 0.1 4032 936 pts/0 S+ 09:31 0:00 grep mysql
When I try to run mysql, I still get the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
Solution
----- ORIGINAL SUGGESTION -----
Try running (as root):
systemctl start mysqld
If this doesn't work please post back to say if the same error returned.
----- FURTHER ADVICE -----
Great that MySQL is now starting at least. Few things to check:
1) Does the socket file actually exist? If not run touch /run/mysqld/mysqld.sock to create it and see if that helps, you might need to change the file to be owned/writeable by the mysql user;
2) Have you checked your my.cnf file to check the mysql configuration is all correct?
3) If the above don't help I'd suggest trying to start mysql again using the --verbose flag so you get a more detailed error output