Monday, April 25, 2011

Getting MySQL to work on CentOs 5

I've bee tearing my hair out trying to get MySQL 5 running on CentOS 5 but I've had hardly any luck. If I leave everything as default, and launch the initial install it works a charm, but if I tell the my.cnf to use a different drive to store the data, I continuously get the "Timeout error occurred trying to start MySQL Daemon." error.

My.cnf is as follows:

[mysqld]
datadir=/database/mysql
socket=/database/mysql/mysql.sock
user=mysql
old_passwords=1
log-error=/database/log/mysqld.log
long_query_time  = 10
log_slow_queries = /database/log/mysql-slow.log
query-cache-type = 1
query-cache-size = 8M
innodb_file_per_table
skip-bdb
set-variable = local-infile=0

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

The folders all have the right privileges and the mysqld.log doesn't have any error messages in there, according to it, MySQL launced successfuly. Oh, and /database is a mounted drive, but even if I trial it on a local directory, I get the same error.

Any ideas what could be going wrong? i've seriously waisted more than 5 hours on this now :(

CHEERS

From stackoverflow
  • Shouldn't the datadir be set to the other drive and everything else (socket) point to the standard install locations?

    d2kagw : Yeah, i've tried that, but the init.d script looks for the socket in the data directory by default, so it would need to live in both... which potentially leads to migration/upgrade issues
    tom : That doesn't sound right. Did you add the standard socket param in my.cnf not just remove it?
    tom : The custom one that is.
    d2kagw : you were right in the end, I just pointed the data directory to the new mount and put in the variable for the socket which kept it in the default location and it works a treat.
  • Did you check selinux settings? Make sure it is disabled (setenforce disabled), or spent some time learn about it (chcon command) To disable on boot look into /etc/sysconfig

    Run the command : getenforce, if it says "Enforced", SE-Linux is On

0 comments:

Post a Comment