LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-25-2012, 01:33 AM   #1
lpallard
Member
 
Registered: Nov 2008
Location: Milky Way
Distribution: Slackware (various releases)
Posts: 970

Rep: Reputation: 44
Post Moving only ONE MySQL database to a different folder, is it possible?


Hi all!

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...

Anybody knows?

many thanks to all!!!
 
Old 12-25-2012, 09:45 PM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 755

Rep: Reputation: 227Reputation: 227Reputation: 227
http://dev.mysql.com/doc/refman/5.5/...lic-links.html
 
Old 12-30-2012, 01:01 PM   #3
lpallard
Member
 
Registered: Nov 2008
Location: Milky Way
Distribution: Slackware (various releases)
Posts: 970

Original Poster
Rep: Reputation: 44
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:

1-Stop mysqld
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
4-restarted mysqld

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...
 
  


Reply


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
Moving 2 months of old files from a folder to another folder. Iyyappan Linux - Server 6 07-13-2012 05:45 AM
Moving a folder, versus moving its contents (within the same partition) the dsc General 7 06-29-2012 05:46 AM
[SOLVED] [APPENDED]Real moving of a folder's content to another folder. MODYSAMA Linux - Newbie 10 02-08-2011 12:30 AM
Moving and replacing entries in a MySQL database kaplan71 Linux - Software 4 04-21-2008 10:06 PM
Moving mySQL database subnet_rx Linux - Software 12 06-30-2004 05:41 PM


All times are GMT -5. The time now is 08:46 PM.

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