|
Posted by Tony on 06/07/05 03:13
"MS" <nospamplaesegr8t_ukuk@yahoo.co.uk> wrote in message
news:d81sbd$5st$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
>
>
> My current DB is on my Linux Server, and I don't have access to any MYSQL
> directories.
> So I think what you are suggesting is not viable for me.
>
> would another possibility be to...
>
> create a PHP file to run SQL that would create the DB and all the tables.
> This I don't see a problem with.
You were also asking to duplicate data, though - and that could present a
problem, depending on how much data you're copying. If it's not too much,
you may be ok.
As for setting up the database & tables, that's pretty straightforward -
just use mysql_query() to send the appropriate queries to the database. In
fact, you should probably use that for creating the database, too, since
mysql_create_db is deprecated - it's better practice to get into.
> but how do you set the connection values...'mysql_user' & 'mysql_password'
> within php and relate this to the DB that is to be created.
>
> mysql_connect('localhost', 'mysql_user', 'mysql_password') ;
basically, you just set them either as strings in the command, or as string
variables. So for user="root" and password="rootpw":
mysql_connect('localhost',' root','rootpw');
or
$host = "localhost";
$user = "root";
$password = "rootpw";
<... any other code can be here if it doesn't change these variables ...>
mysql_connect($host,$user,$password);
You just have to be sure that the user & password you're using have been
entered into the database.
[Back to original message]
|