Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] mysql virtual hosting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
V0rtex
n00b
n00b


Joined: 13 Apr 2003
Posts: 71

PostPosted: Sat Dec 16, 2006 1:04 am    Post subject: [SOLVED] mysql virtual hosting Reply with quote

I am setting up a new server and I realized that mysql now supports the new 'srvdir' use flag. After installing mysql I realized that it put the data directory in /srv/localhost/mysql/datadir/ . I got to thinking about whether because of this it is possible to run eg. multiple mysql daemons with different data directories (ie. one for each virtual host I have). It seems that it would only make sense that this is the case. In my searching, however, I have found nothing on the subject. I cannot seem to find any documentation outlining how to configure mysql this way. I tried many different things including setting up multiple config files, but I can't seem to figure this out. Does anyone have experience doing this or at least have some idea as to how to configure mysql this way? I would be very appreciative for any help in figuring this out, and perhaps I could even write a gentoo-wiki page on the topic.

Last edited by V0rtex on Thu Dec 21, 2006 3:50 am; edited 1 time in total
Back to top
View user's profile Send private message
Sten
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2006
Posts: 109
Location: Prague, Czechia, European Union

PostPosted: Sat Dec 16, 2006 1:54 am    Post subject: Re: mysql virtual hosting Reply with quote

V0rtex wrote:
I am setting up a new server and I realized that mysql now supports the new 'srvdir' use flag. After installing mysql I realized that it put the data directory in /srv/localhost/mysql/datadir/ . I got to thinking about whether because of this it is possible to run eg. multiple mysql daemons with different data directories (ie. one for each virtual host I have). It seems that it would only make sense that this is the case. In my searching, however, I have found nothing on the subject. I cannot seem to find any documentation outlining how to configure mysql this way. I tried many different things including setting up multiple config files, but I can't seem to figure this out. Does anyone have experience doing this or at least have some idea as to how to configure mysql this way? I would be very appreciative for any help in figuring this out, and perhaps I could even write a gentoo-wiki page on the topic.


Yes, it is possible to run multiple MySQL daemons with different data directories but you’ll need to executed them by hand. You can create your own init script that will do this. You’ll need to run them on different ports (or disable using ports and use sockets only). Read manual of ‘mysqld’ for more info, it’s all there.
_________________
You don’t understand, I break things like this!

xor rsi,rsi
lodsb
Segmentation fault
Back to top
View user's profile Send private message
V0rtex
n00b
n00b


Joined: 13 Apr 2003
Posts: 71

PostPosted: Sat Dec 16, 2006 3:25 am    Post subject: Reply with quote

with the current stable version of mysql in portage, I figured out how to get multiple daemons to run on different ports and to use different config files by editing '/etc/conf.d/mysql' but the problem I have is this. With the main data directory I was able to just run
Code:
ebuild /var/db/pkg/dev-db/mysql-5.0.26-r1/mysql-5.0.26-r1.ebuild config

... and I suppose it would get all the default information from the default 'my.cnf' file. It would do a number of things with the data directory such as setting the proper permissions on it and allowing me to set the default root password. I could not, however, figure out if/how it was possible to either make the config script use a different datadir/config file or how to manually set up the databases for each of the virtual hosts. Any ideas on this?
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sat Dec 16, 2006 12:11 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Other Things Gentoo.
Not about getting gentoo installed, so moved here.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
V0rtex
n00b
n00b


Joined: 13 Apr 2003
Posts: 71

PostPosted: Thu Dec 21, 2006 3:49 am    Post subject: Reply with quote

After a lot of time and research I finally found a solution to the problem. I have created a wiki page on gentoo-wiki.com that details the steps and process that I used to solve my problem. The HOWTO is found at http://gentoo-wiki.com/HOWTO_Setup_mysql_virtual_hosting . Hopefully someone will find it useful.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum