[SOLVED] Moving only ONE MySQL database to a different folder, is it possible?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Moving only ONE MySQL database to a different folder, is it possible?
So my Mysql databases are all located in /var/lib/mysql which is located on /var (small partition of 11GB). Unfortunately one of the databases is getting wayyy bigger than I initially hoped for (8.5GB and growing) and as a result, /var is getting full and I am experiencing all kind of strange issues with my server (apache crashes, pages dont load, etc...).
I cleaned up /var a bit and freed about 200MB (deleted tons of logs) but this will buy me maybe a few weeks before the database grows even more and fill /var once again.
So my question: Can I safely move this huge database to a different location (drive or partition) of bigger capacity while keeping all other DB's where they are currently located? The reason being, the current location of /var is located on reliable hard drives mounted in a RAID1 array and automatically backed up to a third HDD. The other drive I would use to relocate the big DB would be a single drive not so reliable (for financial reasons, and eventually will get replaced or RAID'ed)..
I have found websites describing how to move the whole mysql DB repository (in my case /var/lib/mysql) but not how to move a single DB...
wildwizard, this is what I ended up doing... I am not a huge mysql user but I believe the future versions of MySQL should be able to work with databases located in different folders/drives etc... Would be a lot more flexible and dependable..
Anyways, I have created a symlink pointing to a huge drive where I have moved the databases. Works well so far...
At first I had tried this:
2-change the datadir setting in /etc/my.cnf to point to the new location
3-moved all databases from /var/lib/mysql to the new location
But it complained files were missing from /var/lib/mysql and ended up... Clearly the datadir setting was not taken into consideration by mysqld.. I wonder why. Reverting the setting in the config file and creating the symlink between /var/lib/mysql to the new location worked immediately...