Hello when I try to start up my mysqld I get this error:
[root@localhost /]# service mysqld restart
Stopping mysqld: [ OK ]
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
the main reason is that my.cnf file can't find my mysql.sock file.
[root@localhost /]# mysqladmin -u root -p status
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
When I try to search it with :
sudo find / -type s | grep mysqld.sock
I'll get
find: ‘/proc/3253/task/3253/fd/5’: Bestand of map bestaat niet
find: ‘/proc/3253/task/3253/fdinfo/5’: Bestand of map bestaat niet
find: ‘/proc/3253/fd/5’: Bestand of map bestaat niet
find: ‘/proc/3253/fdinfo/5’: Bestand of map bestaat niet
"Bestand of map bestaat niet" == "File or directory don't exists"
I'm new at this so can anyone help me please?
What a pain! I stumbled upon same problem (on RedHat) and this helped me:
service mysqld stop
rm -rf /var/lib/mysql/*
service mysqld start
mysql_secure_installation
Hope that helps. Good luck!
"the main reason is that my.cnf file can't find my mysql.sock file."
Nope. "THE MAIN REASON" is mysqld has not started
, so there is no mysql.sock and any client cannot establish connection.
Currently "why mysqld failds" is broad question. MySQL Error log has the reason 'Why MySQL fails'. If you know where mysql error log is, just open it, and post error message into you question.
But probably I guess you don't know where mysql error log is....
Identify where mysql error log is
So, we need to identify where it is. we could guess somewhere... but the exact approach is using strace
$ strace -f > strace.log 2>&1 service mysqld start
now strace.log has all system call related to MySQL Deamon. open strace.log with any editor and search 'err"'. in my case
[pid 26976] open("/XXX/hostname.err", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3
when open() fails
It could happen open()
fails, common error is
so you can find why mysqld fails to start in '/XXX/hostname.err'. we highly appreciate if you post error message.
p.s.
I have test strace with
$ strace -f > strace.log 2>&1 mysql.server start
Not sure working with service mysqld
, but no reason not to work
"I don't get anything in return with: $ strace -f > strace.log 2>&1 service mysqld start "
Actually service mysqld start
invokes /etc/rc.d/init.d/mysqld start
(assuming CentOS or Fedora). so, you could try.
$ strace -f > strace.log 2>&1 /etc/rc.d/init.d/mysqld start
If my.cnf
which you referenced is right file for mysqld, open it and search [mysqld]
section. It looks like as follows
[mysqld]
user = username
port = 1111
basedir = /path/
datadir = /path/data
MySQL error log is in /path/data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With