Solved

How to move mysql to another partition on ubuntu server

Posted on 2008-06-19
4
878 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Creating and Managing Databases with phpMyAdmin in cPanel.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

19 Experts available now in Live!

Get 1:1 Help Now