LinuxQuestions.org
Visit Jeremy's Blog.
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 10-05-2005, 01:21 PM   #1
android6011
Member
 
Registered: May 2005
Posts: 255

Rep: Reputation: 30
MYSQL data dir


I have slackware 10.2 and windows. I want to have Windows and Mysql to share the data dir. I have the data dir i want them to share at /machination/data/ . How can I set mysql up in Slackware ( I already did it in Windows) to use that data dir which contains all the databases etc? Thanks

I was following one guide and renamed my-medium.cnf to my.cnf and adding 'datadir=/machination/data/' but it still loads the default data dir

Last edited by android6011; 10-05-2005 at 01:27 PM.
 
Old 10-05-2005, 02:36 PM   #2
Simon_6162
Member
 
Registered: Jul 2004
Location: UK
Distribution: Fedora, Gentoo, Redhat Enterprise
Posts: 141

Rep: Reputation: 16
You can set the location of the base directory which contains the databases in /etc/my.cnf.
 
Old 10-05-2005, 04:35 PM   #3
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
what do I change in the my.cnf to point to the new base dir?
 
Old 10-06-2005, 05:25 AM   #4
Simon_6162
Member
 
Registered: Jul 2004
Location: UK
Distribution: Fedora, Gentoo, Redhat Enterprise
Posts: 141

Rep: Reputation: 16
well my file looks like this

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

So just change the datadir=/var/lib/mysql line to your new location., I would also suggest you merge the contents of the old directory into the new one, so you don't loose anything.

BTW I've never tried this so if someone else knows different feel free to add a comment.
 
Old 10-06-2005, 06:53 PM   #5
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
still doesnt load the correct database location so frustrating !
 
Old 10-06-2005, 07:50 PM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
There is actually an easier way. For each database in /var/lib/mysql, replace the database directory with a soft link pointing to the directory you actually want it to use.

So say you have database1 in /var/lib/mysql but you want to use database1 in /machination/data. Backup database1 first (just in case) then delete the directory from /var/lib/mysql. Then add the softlink in /var/lib/mysql

ln -s /machincation/data/database1 database1

when you run ls -l you should see the link pointing to the right place and mysql should be using the database in /machination/data

Of course instead of doing it on a database by database method, you could always have the mysql directory be a softlink pointing somewhere else

Last edited by Hangdog42; 10-06-2005 at 07:52 PM.
 
Old 10-07-2005, 11:10 AM   #7
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
how do i make a soft link?
 
Old 10-07-2005, 11:21 AM   #8
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
i did that now I get "Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
051007 11:21:19 mysqld ended
"
 
Old 10-07-2005, 11:42 AM   #9
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
i should have added this earlier but I want the two mysqls to share everything. the reason being is I have different users. Just sharing the one database isnt going to do anything for the other users.
 
Old 10-07-2005, 01:20 PM   #10
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
OK, if you want them to share all the databases, then you have to have /var/lib/mysql be a softlink pointing to wherever you want the databases to really be. And you use the ln command to create that link.

As for mysqld not starting, we are going to need to know more. Check in the .err file in /var/log/mysql for more information.


One final note....I'm not so sure that having two separate daemons working off of the same database is such a good idea. It would probably be best to set up one system as a server and then connect to that server when you need database access.
 
Old 10-07-2005, 01:28 PM   #11
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
051007 13:25:07 mysqld started
/usr/libexec/mysqld: File './localhost-bin.000017' not found (Errcode: 13)
051007 13:25:08 [ERROR] Could not use localhost-bin for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
051007 13:25:08 [ERROR] Aborting

051007 13:25:08 [Note] /usr/libexec/mysqld: Shutdown complete

051007 13:25:08 mysqld ended

i deleted all the sql users but root so im al lset that way. The two daemons arnt on two diff amchines, im dual booting windows and linux, thats why im trying to run lamp and wamp so i can go between them and still have my site up
 
Old 10-07-2005, 01:44 PM   #12
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
OK, Since Windows only reads its own file system, I'm assuming that the databases are on a Windows FAT32 partition (please correct me if I'm wrong). Does the Linux user that mysql runs under have read and write permissions on that partition?
 
Old 10-07-2005, 04:04 PM   #13
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
yes, because i can write to my htdocs, so i assume it has rights to the data folder
 
Old 10-08-2005, 08:49 AM   #14
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally posted by android6011
yes, because i can write to my htdocs, so i assume it has rights to the data folder
OK, now you've got me completely confused. What does htdocs have to do with the mysql directory? Htdocs is for Apache, not mysql, and it is highly likely that Apache is running under a different user than mysql. I know I have them running under different users.

The bottom line is that something basic is going wrong here. The earlier suggestions you got from Simon should have worked and the linking should have worked also. I'm going to suggest trying one of two things:

1) Blow away the Windows data by copying everything (and I mean everything) in /var/lib/mysql to the windows partition and make sure that /var/lib/mysql is a soft link pointing to that Windows partition

2) Uninstall mysql, clean out all the directories, and then reinstall. But before starting it, edit the my.cnf file to point to the partition you want.
 
Old 10-08-2005, 11:05 AM   #15
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
I was just saying the htdocs is on the same partition with the sql data and i can write to the htdocs so i doubt it is a permission problem. Ill try doing what you said and repost when im done
 
  


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
what is the default package data dir? cheesetastic Linux - Newbie 8 04-12-2004 10:34 AM
MYSQL on Slackware9.0 ./mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13) Litn Linux - Software 2 09-02-2003 10:00 PM
MySQL Data Directory Hamma Linux - Software 1 05-28-2003 03:30 PM
inserting data in mysql zuessh Linux - Software 4 05-19-2003 02:00 PM
Need Help: Can't read Mysql Dir, ErrorCode =13 happywht Programming 2 10-03-2001 10:24 AM

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

All times are GMT -5. The time now is 02:52 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