[GRLUG] Moving MySQL Data Dir

Olding, Jim JOlding at gts.gaineycorp.com
Tue Oct 9 10:38:58 EDT 2007

I'm trying to move the data dir for MySQL on CentOS from the default
(/var/lib/mysql) to a 2nd drive (/db/mysql).  Here's the process I'm

Stop the running MySQLd service
Copy everything in /var/lib/mysql to /db/mysql
Update /etc/my.cnf to point datadir to /db/mysql
Start MySQLd

Here's the output from trying to start the service back up after the
[root at lct-linux mysql]# service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]
[root at lct-linux mysql]# service mysqld status
mysqld (pid 5851) is running...

And here's mysqld.log:
071009 10:17:41  mysqld started
071009 10:17:41  InnoDB: Started; log sequence number 0 2650890
/usr/libexec/mysqld: ready for connections.
Version: '4.1.20'  socket: '/db/mysql/mysql.sock'  port: 3306  Source

I can see the mysqld process running, and it is listening on port 3306,
but nothing can seem to connect to it.  If I point datadir back to
/var/lib/mysql, everything works beautifully.  Ideas?

More information about the grlug mailing list