MySQL (mysqld) fails to start!

Hello,

I have recently installed MySql and I encourage an error.
I am using Fedora 15 and when I am trying to start mysqld service i am getting
the following error message:

Starting mysqld (via systemctl):  Job failed. See system logs and 'systemctl status' for details. [FAILED]

If I try to start it from Service Configuration GUI it fails too.

Checking the system logs it just says:

Sep 27 11:49:11 mp054a systemd[1]: mysqld.service: control process exited, code=exited status=1
Sep 27 11:49:11 mp054a systemd[1]: Unit mysqld.service entered failed state.

If I try to type 'msql' from command line I am getting the following error
msg:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I have read about the /etc/my.cnf file and I tried to edit it somehow
but with no success.
My /etc/my.cnf contains the following:

[mysqld]
#datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections=125
table_cache=2500
thread_cache_size=100
thread_stack=250K
wait_timeout=10
join_buffer=5M
myisam_sort_buffer_size=15M
query_cache_size=15M
read_rnd_buffer_size=5M
default-character-set=utf8
default-collation=utf8_unicode_ci
character-set-server=utf8
collation-server=utf8_unicode_ci 

[mysql.server]
user=mysql
#basedir=/var/lib
old-passwords = 1

[client]
default-character-set=utf8

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Note that I have commented datadir and basedir. That's because I had the same mysqld problem yesterday and I found online that if I comment them it might work.And indeed the problem solved.
But later I tried to install moodle and I had to make some changes to the permission of some folders over /var/ directory. I had to play a little bit and in the end I manage to figure permissions in such a way that moodle was working. (Note that permission changes have been made after I managed to start mysqld successfully).

Today when I power my computer on and tried to restart httpd and mysqld, the latter one failed.

If I uncomment datadir and basedir mysqld still fails to start.

If I do 'ls -la /var/lib' I am getting the following about mysql:

drwxr-xr-x.  5 mysql mysql 4096 Sep 27 11:49 mysql

If I do 'ls -la /var/lib/mysql' I am getting the contents of mysql:

drwxr-xr-x.  5 mysql mysql     4096 Sep 27 11:49 .
drwxr-xr-x. 41 root  root      4096 Sep 26 22:04 ..
-rwxr-xr-x.  1 mysql mysql 35651584 Sep 27 11:49 ibdata1
-rwxr-xr-x.  1 mysql mysql  5242880 Sep 27 11:49 ib_logfile0
-rwxr-xr-x.  1 mysql mysql  5242880 Sep 27 11:49 ib_logfile1
drwxr-xr-x.  2 mysql mysql    20480 Sep 26 17:07 moodle
-rwxr-xr-x.  1 mysql mysql    35556 Sep 27 11:49 mp054a.halls.manchester.ac.uk.err
drwxr-xr-x.  2 mysql mysql     4096 Sep 26 02:29 mysql
drwxr-xr-x.  2 mysql mysql     4096 Sep 26 02:29 performance_schema

I have noticed that if I do 'ls -la /tmp/' I can see the following about mysql.sock:

lrwxrwxrwx.  1 mysql   mysql        25 Sep 26 03:13 mysql.sock -> /var/lib/mysql/mysql.sock

whereas I cannot find anything about mysql.sock on /var/lib/mysql

I tried to change socket to 'socket=/tmp/mysql.sock' in the my.cnf and
nothing changes.

I am not an expert user on linux. I hope the details I added above can
help you help me :slight_smile:

I would appreciate any help. Thanks in advace!

Please post the content of the error log file ( /var/lib/mp054a.halls.manchester.ac.uk.err or /var/log/mysqld.log , choose the most recent).

Hello radoulov,

Thank you for your answer. It seems that we have found something here.

This is the log of the last attempt to start mysqld service from

/var/lib/mysql/mp054a.halls.manchester.ac.uk.err
110927 15:04:00 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
110927 15:04:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110927 15:04:47 [Note] Plugin 'FEDERATED' is disabled.
110927 15:04:47 InnoDB: The InnoDB memory heap is disabled
110927 15:04:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110927 15:04:47 InnoDB: Compressed tables use zlib 1.2.5
110927 15:04:47 InnoDB: Using Linux native AIO
110927 15:04:47 InnoDB: Initializing buffer pool, size = 128.0M
110927 15:04:47 InnoDB: Completed initialization of buffer pool
110927 15:04:47 InnoDB: highest supported file format is Barracuda.
110927 15:04:47  InnoDB: Waiting for the background threads to start
110927 15:04:48 InnoDB: 1.1.8 started; log sequence number 6768017
110927 15:04:48 [ERROR] /usr/libexec/mysqld: unknown variable 'default-character-set=utf8'
110927 15:04:48 [ERROR] Aborting

110927 15:04:48  InnoDB: Starting shutdown...
110927 15:04:49  InnoDB: Shutdown completed; log sequence number 6768017
110927 15:04:49 [Note] /usr/libexec/mysqld: Shutdown complete

110927 15:04:49 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

According to this the error is: unknown variable 'default-character-set=utf8'
If I comment that line from /etc/my.cnf file (on [mysqld]) then the log gives an unknown variable error again, but this time for default-collation=utf8_unicode_ci. If I comment both lines:

#default-character-set=utf8
#default-collation=utf8_unicode_ci

then mysqld starts successfully.

The thing is that moodle requires this two lines and I cannot comment them.

Any ideas of why I am getting the unknown variable problem ?

If I recall correctly, those variable names are deprecated, the new names should be something like this:

character-set-server
collation-server

Check the documentation (the link is for 5.5, check the manual for your specific version).

The strange think is that when I was installing moodle I had to change the character set of mysql and according to a moodle documentation I had to add those lines in my.cnf:

So according to you now I should delete the first two and leave only the latter two.
Things look to work fine now. I hope I will not have any further problems which I cannot see now.

Thank you very much for helping me