[mdlug] MYSQL question

David Lane dcl400m at yahoo.com
Fri Mar 18 16:21:20 EDT 2011


You would have one server. But different Data bases:

\\www\site1 --> site1 

\\www\site2 --> site2 



<?php

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Not connected : ' . mysql_error());
}

// make foo the current db
$db_selected = mysql_select_db('Site1', $link);
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}
?>  

So your scripts for site1 will use "site1" for the database selection at connect
on your second site use "site2".

Some admins would like even to give different login's for the different sites to 
keep things separate.

David 



________________________________
From: "mat.enders at gmail.com" <mat.enders at gmail.com>
To: mdlug at mdlug.org
Sent: Fri, March 18, 2011 4:01:33 PM
Subject: [mdlug] MYSQL question

Hello all,

          I have a quick question. If you have multiple web sites on a server 
where do the database(s) associated with those sites live?  Do they live in the 
document root for each web site e.g. /var/www/site1, /var/www/site2?

Thanks,
Sent on the Sprint® Now Network from my BlackBerry®
_______________________________________________
mdlug mailing list
mdlug at mdlug.org
http://mdlug.org/mailman/listinfo/mdlug



      



More information about the mdlug mailing list