[plug] Problems with mysqld on virtual CentOS 5.3

Peter Sutter sutterp at sopac.com.au
Wed Jun 10 22:10:43 WST 2009


I just can't get mysql on localhost going with 
datadir=other_than_/var/lib/mysql. This is on a CentOS 5.3 virtual machine 
running on a Xen CentOS 5.3, both patched as of today.

Starting with no mysql data existing, i.e. after a clean install, starting 
mysql will setup the empty databases in the datadir directory as specified 
in /etc/my.cnf
------------------------
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/data/mysql/mysqld.pid
------------------------

This file clearly states that datadir is /data/mysql, also that the socket is 
to be on /data/mysql as should be the pid file. The owner of the whole 
directory tree is mysql:mysql, and yes it has read and write access.

Start mysql
------------------------
[root at manwe ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h manwe.sopac.com.au password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
 [OK]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:   [FAILED]
------------------------

yet:

------------------------
[root at manwe ~]# service mysqld status
mysqld (pid 3142) is running...
------------------------
But it just said it isn't; at least that is how I interpret FAILED.

Now try to set the root password 
------------------------
mysqladmin -u root password 'password'
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!
------------------------

Where the heck does /var/lib/mysql/mysql.sock comes from? /etc/my.cnf clearly 
states:
socket=/data/mysql/mysql.sock

Funny enough, mysqladmin -u root password 'password' -h 'hostname' succeeds.

It looks as if localhost ignores my.cnf and defaults to /var/lib/mysql. The 
database on localhost just doesn't seem to exist.

Has anybody any thoughts on how to fix?

Thanks for any help

Peter



More information about the plug mailing list