LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2007, 02:14 PM   #1
lexthoonen
LQ Newbie
 
Registered: Jan 2007
Posts: 19

Rep: Reputation: 0
how to change the location of mysql


for my dedicated web server that i rent, i think mysql was by default set up in /var in stead of /home.

that might as well be normal, i have no clue

Now, my 4.8 GB /var has only 836 MB free, and my 99.9 GB /home has 91.3 GB free.

What should I do? Change the mysql to /home or add space to /var ?

And... how?

(I'm new with linux so all help is appreciated)

Thanks!
 
Old 01-25-2007, 04:12 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,292

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Hi

MySql has a config file. On my system its at /etc/mysql/my.cnf. In there is a line like:
datadir=/var/lib/mysql
You dont say what distro you have, so it might be different on your computer.

You can copy or move all in this directory to a different place, and then update the my.cnf file.

NB:
MySql has to be stopped when you do this!
If you copy, use the -p option to keep permissions, e.g.
cp -r -p /var/lib/mysql /home/mysql
 
Old 01-25-2007, 11:45 AM   #3
lexthoonen
LQ Newbie
 
Registered: Jan 2007
Posts: 19

Original Poster
Rep: Reputation: 0
mysql location

Thanks!

This sounds very healthy, I'll do it and will let you know how it went. Thanks again.
 
Old 01-25-2007, 11:55 AM   #4
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
Quote:
You can copy or move all in this directory to a different place, and then update the my.cnf file.
Copying all the files does work, but from my experience it is better to take a mysql dump of the database. I also had the same problem. I rsync-ed the whole directory to another place, change the path in my.cnf but still it gave errors. I had to reindex after which everything worked fine.

--
Prasanta
 
Old 01-25-2007, 12:02 PM   #5
lexthoonen
LQ Newbie
 
Registered: Jan 2007
Posts: 19

Original Poster
Rep: Reputation: 0
db dump

Okay, I'll keep that in mind, thanks. (I even know how to do that i think )
 
  


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
Location of mysql logs? khwang Linux - Newbie 7 12-17-2010 06:51 AM
Location and language change davidsrsb Ubuntu 0 01-09-2007 09:39 AM
Why change location of nano sigma957 Debian 1 06-18-2005 02:20 PM
MySQL data Location. AbsoluteMonkey Linux - General 2 12-22-2004 04:58 PM
how to change location of /home? mark_2811 Linux - General 4 01-23-2004 06:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration