[GRLUG] Moving MySQL Data Dir

Roberto Villarreal rvillarreal at mktec.com
Tue Oct 9 11:24:15 EDT 2007


On Tuesday 09 October 2007, Olding, Jim wrote:
> 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 following:
>
> 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 move:
> [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 distribution
>
> 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?
> _______________________________________________
> grlug mailing list
> grlug at grlug.org
> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug

Shot in the dark, but verify the socket is actually created (i.e. 
permissions).  By default, if you are trying to connect to a local 
DB, it will use the socket.  So just because the port is open doesn't 
really mean anything.  You could probably try starting the client 
forcing the use of the port (or accessing the DB from another host, 
if you have proper permissions), and I'm guessing it might work.  
Hopefully this gives you a starting point at least...

Roberto


More information about the grlug mailing list