MySQL use with Virtual Hosting

Discussion in 'Server Operation' started by artomason, Sep 26, 2008.

  1. artomason

    artomason New Member

    Is there a way to setup MySQL with Virtual Hosts so that the Data for the Virtual Host MySQL database is stored in the users document root?




    I checked around and really couldn't find a detailed setup for this purtaining to Ubuntu Server 8.04 LTS.
  2. marpada

    marpada New Member

    Last edited: May 13, 2011
  3. artomason

    artomason New Member

    Sorry about that. There is still alot about Linux that I simply do not understand. So some of this might not be to the current technical babble.

    Say I have a WebServer that is currently running 3 different domains using Virtual Hosts thru Apache2.


    say and want to use PHP based forums such as vBulletin or phpBB, and me, being more of a organization freak, want to make it so there mysql data for each individual mysql database is located in there home directory in a folder called mysql so there structure would look something like this.

    /home/ <--- all database info would be stored here for that domain.
    | - /home/
    | - /home/

    essentially I want to keep as much away from the actual server as possible and try to group most of the user information and data into there home directory. I hope that makes a bit more sense.
  4. marpada

    marpada New Member

    In Unix/Linux everything has its place, and in Mysql databases reside in /var/lib/mysql/dbname. There are many reasons for this, for example /var may be in a different disk that /home, permission,etc, so I suggest you learn the Linux "philosophy".

    If you insist in going "the other o.s. way", you can do what you want creating symbolic links (kind of direct accesses) from the home dir to the database dir, so the data will still be where is has to be but it would seem that is in the home dir..

    $ ln -s /var/lib/mysql/firstdomaindb /home/
    Last edited: Mar 30, 2011
  5. artomason

    artomason New Member

    Thank you for the information. I suppose making a link would definatly work, I was thinking it might be a bit simpler to preform just one back up and beable to capture everything a domain has in a single backup including the MySQL data that the paticular domain has. In anycase thanks for the information.

Share This Page