1

My problem yesterday (MySQL - Alter Table Fails As Workbench Tries To Create Existing Table) was caused by /dev/sda2 (/root) running out of space.

The cause of this was that, by default, MySQL had installed the DataDirectory (datadir) on /dev/sda2(/root).
I therefore recursively copied its contents to /dev/sda3 (/home) after stopping the MySQL server.
I also editted /etc/init.d/mysql, /etc/mysql/my.cnf and /etc/apparmor.d/usr.bin.mysqld to reflect this change.

After both trying to restart the MySQL server and a reboot the server is still not running. The error.log in /var/log/mysql is also not being appended to. Obviously I have missed something but what? I am running Linux Mint 13.

MichaelJohn
  • 449
  • 2
  • 5
  • 19

1 Answers1

0

I have done the same thing. Be absolutely sure that all rights and owners are intact. You can do this with cp -rp if I'm correct. Rsync the folder locally should also keep owners and rights intact. You don't have to change the config however. A symlink will do.

  • Rename the original datadir to datadir-old or something similar.
  • Then create a symlink to the new location.
  • If you want the symlink to have right owner, create a new folder (tmp), move the symlink inside that folder, then change the owner of the tmp folder and its contents, then move the symlink back.
  • Undo the changes to the config files.

On the commandline... (I haven't tried this so check if all is as it should be!)

sudo -i
cd /var/lib
mv mysql mysql-old
ln -s /home/mysql mysql
mkdir tempdir
mv mysql tempdir
chown -R mysql:mysql tempdir
mv tempdir/mysql .
rm -rf tempdir

In the directory listing I see the following on my system. Yours should be similar!

drwx------  7 mysql         mysql          4096 Feb  6 12:01 mysql  
-rw-rw----  1 mysql mysql 1671430144 Feb  6 17:37 ibdata1  
-rw-rw----  1 mysql mysql    5242880 Feb  6 17:37 ib_logfile0  
-rw-rw----  1 mysql mysql    5242880 Jan 28 14:35 ib_logfile1  
drwx------  2 mysql mysql      24576 Jan 28 14:34 testdatabase_local  
drwx------  2 mysql mysql       4096 Jan 28 13:38 mysql
-rw-rw----  1 mysql mysql          6 Jan 28 13:38 mysql_upgrade_info
drwx------  2 mysql mysql       4096 Jan 28 13:38 performance_schema

Try this and see if that fixes your problem.

SPRBRN
  • 138
  • 1
  • 6