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.