"the main reason is that the my.cnf file cannot find my mysql.sock file."
Nope. "MAJOR CAUSE" - mysqld has not started , so there is no mysql.sock, and any client cannot establish a connection.
Currently, "why mysqld failds" is a broad question. There is a reason in the MySQL error log "Why MySQL is not working." If you know where the mysql error log is located, just open it and send an error message to the question.
But probably, I think you do not know where the mysql error log is located ....
Determine where mysql error log is located
So, we need to determine where it is. we could guess somewhere ... but the exact approach uses strace
$ strace -f > strace.log 2>&1 service mysqld start
strace.log now has all the system calls related to MySQL Deamon. Open strace.log with any editor and find "err". in my case
[pid 26976] open("/XXX/hostname.err", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3
when open () fails
open() may crash, a common error
- '2' for "no such file or directory" means "no directory / XXX.
- '3' for 'permission denied' means that you (or the user in my.cnf) do not have the right to write to 'XXX'
so you can find why mysqld does not start in '/XXX/hostname.err'. We appreciate if you post an error message.
ps
I have test strace with
$ strace -f > strace.log 2>&1 mysql.server start
Not sure what works with service mysqld , but no reason not to work
UPDATE
"I get nothing in return: $ strace -f> strace.log 2> & 1 service mysqld start"
In fact, service mysqld start calls /etc/rc.d/init.d/mysqld start (assuming CentOS or Fedora). so you can try.
$ strace -f > strace.log 2>&1 /etc/rc.d/init.d/mysqld start
If the my.cnf you are referencing is the correct file for mysqld, open it and search for [mysqld] . It looks like this
[mysqld] user = username port = 1111 basedir = /path/ datadir = /path/data
The MySQL error log is located in /path/data