[GRLUG] Moving MySQL Data Dir
geektoyz at gmail.com
Wed Oct 10 20:36:48 EDT 2007
Ownership/Permissions are generally the killer. Check the
"/var/lib/mysql" directory and copy exactly ( cp -a /var/lib/mysql
/db/ && mv /var/lib/mysql /var/lib/mysql-bak ). After you check
those, make a symbolic link from the old dir to the new ( ln -s
/db/mysql /var/lib/ ). If it's just a matter of something not finding
stuff, that should tell ya.
On 10/9/07, Roberto Villarreal <rvillarreal at mktec.com> wrote:
> 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...
> grlug mailing list
> grlug at grlug.org
More information about the grlug