[nSLUG] Issues moving MySQL to a different folder in Ubuntu 16.04

Paul Russell prussellster at gmail.com
Tue Aug 9 23:14:59 ADT 2016


Hi

I've recently updated one of my servers from Ubuntu 14.04 to 16.04. I've
also added a new volume, mounted as /sdb1, to hold the MySQL data in
/sdb1/mysql

The starting point was: Everything was working fine. MySQL was happy and
running in the original location, I could access the data, etc. But the
drive was filling up. It's a small OS drive, and I wanted to move the data
to a larger data drive to protect the OS.

So then I followed the instructions given in many pages like:
http://www.ubuntugeek.com/how-to-change-the-mysql-data-default-directory.html
and
http://askubuntu.com/questions/137424/moving-mysql-datadir

There recommendations are, basically:
1) Shut down MySQL
2) use cp -R -p to copy the data
3) rename the old folder to guarantee no conflict
4) Update /etc/mysql/mysql.conf.d/mysqld.cnf to point to the new folder
5) Update apparmor to include the new folder
6) create /var/lib/mysql/mysql --- since there seemed to be a bug in the
launcher that explicitly looked for this
7) start up MySQL, and carry on

and I have gotten a number of errors when trying to fire up the MySQL
service after the changes.

The errors include:
- /var/lib/mysql doesn't exist (of course it doesn't, I've removed it,
since I want you to use the new one)
- mysqld: File './auto.cnf' not found (Errcode: 13 - Permission
denied) (yes, it does, but you're probably looking in the wrong place)
- mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission
denied)
- [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to
create it. (I can't run that, since MySQL was shutting down when you sent
that message)

I've also uninstalled and reinstalled MySQL

At this point I've given up and have reverted to using the default
installation path. It's working, but I expect to fill up this volume
shortly.

Has anyone else done this? Have I missed anything? Or is this just an
impossibility for now? I'd have a hard time believing that last one, but
right now I have spent enough time futzing with it and have to start being
productive again.

Paul

-- 
Paul Russell
Parade Marshall, 2016 Sackville Canada Day Parade
President, Sackville Cobequid PC Association
ZipSure.ca - Insurance In A Click
(902) 830-5043
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nslug.ns.ca/pipermail/nslug/attachments/20160809/b4f89b46/attachment.html>


More information about the nSLUG mailing list