Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 06-22-2010, 07:28 AM   #1
Registered: Mar 2010
Distribution: Debian, Ubuntu
Posts: 31

Rep: Reputation: 0
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?
Old 06-22-2010, 09:55 AM   #2
Registered: Mar 2010
Distribution: Debian, Ubuntu
Posts: 31

Original Poster
Rep: Reputation: 0
Reverted the config. Right now, mysql is not running:

$ 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:

$ sudo service mysql start
start: Job is already running: mysql
Which led me to searching for that message, and I found this bug:

The last reply is:
the short answer: you have to run mysqld as user mysql
So I ran:
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!


mysql, previous

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to move datadir of mysql edudirectories Linux - Enterprise 1 02-14-2009 08:29 PM
Start MySQL with a non-default datadir nifflerX Linux - Enterprise 9 02-28-2006 06:42 AM
Trying to move datadir of mysql edudirectories Linux - Software 2 02-10-2006 07:25 AM
mySQL my.cnf (moving default datadir) not working! madfitz Linux - Newbie 4 02-09-2006 08:15 PM
mysql reinstallation distorted by previous tables in /var/mysql mad4linux Linux - Software 0 10-04-2005 02:39 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration