Solved

How to move mysql to another partition on ubuntu server

Posted on 2008-06-19
4
879 Views
Last Modified: 2013-11-15
Im preparing for my install of DRBD for a database application and I have just setup a new partition on my ubuntu server hard drive that I would like mysql database to reside on. Right now I did the initial install of ubuntu server with the LAMP installation so the database is already on the server. How do I move the database and all of its files to my new partition? Below is my printout of fdisk -l

Disk /dev/sda: 146.8 GB, 146809028608 bytes
255 heads, 63 sectors/track, 17848 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00055edd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       17464   140279548+  83  Linux
/dev/sda2           17472       17848     3028252+   5  Extended
/dev/sda3           17465       17471       56227+  83  Linux
/dev/sda5           17472       17848     3028221   82  Linux swap / Solaris

I would like mysql to be moved to sda3 instead of sda1. Thanks
0
Comment
Question by:tupac1979
  • 2
4 Comments
 
LVL 4

Expert Comment

by:albuitra
ID: 21825716
sda3 is very small
0
 
LVL 48

Expert Comment

by:hernst42
ID: 21825741
shutdown mysql, pack every thing in /var/lib/mysql, mount /dev/sda3 to /var/lib/mysql untar everything, start mysql and the data should be moved to an extra parition. So you can also replace this mountpoint with drdb mount point.
0
 

Author Comment

by:tupac1979
ID: 21826273
hernst42 thanks I know your instructions are good but Im a beginner so can you provide me a few commands and then that will be all I need. Thanks
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 21826719
controlling mysql:
/etc/init.d/mysql stop/start

packing
tar -czf /tmp/mysql.tgz /var/lib/mysql
unpacking
cd /
tar -xzf /tmp/mysql.tgz

mount /dev/sda3 /var/lib/mysql

also edit /etc/fstab to reflect the changes of mounting
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now