Solved

How to move mysql to another partition on ubuntu server

Posted on 2008-06-19
4
889 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
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.
Suggested Courses

624 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