LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-22-2004, 06:55 PM   #1
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Rep: Reputation: 30
Assigning MySQL databases to certain hard drives


Hey-
I've begun the ardueous trek of starting up my own website, which will be a community like this with the emphasis based mostly on a forum, but will also include blogging software, webmail, and a 'sermons' directory that my friend and I will post to as moderators of this site.

Anyway, as one could imagine, this new site will be an absolute resource CHUGGER. My webspace will be my brother's server, who will host me only because I am providing my own hard drive.

This hard drive will be mounted in /home/freespeak and will be hdb

Anyway, the question.

How does one make an SQL database be stored on ONLY that hdb, as to not interfere with the rest of his server's daily tasks? What is the command in the MySQL shell? Is it even possible?

Any feedback is greatly appreciated. Thanks in advance!

Last edited by benrose111488; 11-22-2004 at 06:57 PM.
 
Old 11-22-2004, 07:46 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Well, I've never done it, but according to this article , since MySQL stores each database in its own directory, you can set up a symlink pointing to another location. You'll just have to make sure that the symlink has the exact same name as the database.
 
Old 11-22-2004, 09:09 PM   #3
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
Whoaaaaaa

I'm CERTAINLY not a newbie to MySQL, but those technical docs just go straight over my head.

And the colorful diagrams never help. :-/

Sorry, but could someone rationalize and simplify it for me? I don't kin well to big words and fancy diagrams.

Thanks again, Hangdog
 
Old 11-23-2004, 07:18 AM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
OK, this is how I understand it.......

The MySQL admin (your brother?) would create the necessary databases and give you appropriate permissions. That would create a database directory in the normal MySQL data directory. Now on your new hard drive, you want to create a directory where you really want MySQL to store the data. Once that is done, move the files MySQL created from the MySQL database directory to the new hard drive directory. Finally, replace the MySQL database directory for this database with a link like this:

ln -s /path/to/new/directory databasename

In theory, that should "fool" MySQL into thinking that it is writing to a normal database directory, but in fact is writing to your new hard drive.

As I said, I've never done this, but looking at how MySQL works, I see no reason why this shouldn't do the trick.
 
Old 11-23-2004, 11:23 AM   #5
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
ahhh makes perfect sense... thank you very much

In theory, you're right, it should work. Symbollic links rock

Any idea where the SQL satabases are stored by default?
 
Old 11-23-2004, 11:42 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
You may have to dig into your my.cnf file to make sure, but at least with the standard Slackware package, the databases are in /var/lib/mysql
 
  


Reply



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
Restoring Mysql Databases davethegenius Linux - Software 2 08-05-2005 02:01 PM
Where is MYSQL databases stored on the HDD? jon_k Linux - Software 1 07-12-2004 10:27 PM
Comparing two MySQL Databases WeNdeL Linux - Software 1 09-30-2003 03:47 PM
restoring mysql databases? and mysql permissions... armegeden Linux - Software 0 03-13-2003 11:04 AM
mysql databases k3v0 Linux - Software 2 12-03-2002 07:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:45 AM.

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
Open Source Consulting | Domain Registration