Solved

How to move mysql to another partition on ubuntu server

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

#Citrix #POC #XenDesktop #vCenter #VMware #ESX
Creating and Managing Databases with phpMyAdmin in cPanel.
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.

803 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