LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   MySQL datadir from previous install (http://www.linuxquestions.org/questions/linux-server-73/mysql-datadir-from-previous-install-815636/)

mwjones 06-22-2010 07:28 AM

MySQL datadir from previous install
 
I was running Ubuntu 9.10 and had the MySQL datadir moved to a different directory, /store/mysql. Due to a filesystem problem on the upgrade to Ubuntu 10.04, I was forced to reinstall. My /store/mysql was copied back over, and I made the appropriate changes to /etc/mysql/my.cnf and /etc/apparmor.d/usr.sbin.mysqld, but MySQL hangs when I go to start it and nothing is showing up in any of the logs.

How do I get MySQL to recognize the datadir from the previous install?

mwjones 06-22-2010 09:55 AM

Reverted the config. Right now, mysql is not running:

Code:

$ ps -ef | grep -i mysql
mwjones    22465 18758  0 09:26 pts/3    00:00:00 grep --color=auto -i mysql

But when I tell it to start:

Code:

$ sudo service mysql start
start: Job is already running: mysql

Which led me to searching for that message, and I found this bug: https://bugs.launchpad.net/null/+bug/551097

The last reply is:
Quote:

the short answer: you have to run mysqld as user mysql
So I ran:
Code:

sudo -u mysql /usr/sbin/mysqld &
This allowed me to connect and authenticate using /var/lib/mysql. At this point, I:
  1. Issued sudo service mysql stop
  2. Changed the MySQL and apparmor configs back to use /store/mysql
  3. Restarted apparmor
  4. Issued sudo service mysql start

Now everything works! My guess is that there was some sort of mutex that was holding up everything, and running the mysqld manually sorted it all out. Thanks to Ryan Dwyer on the Ubuntu forums for his help!


All times are GMT -5. The time now is 07:40 PM.