|
Posted by MS on 06/07/05 17:58
> > 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.
I honestly dont think the amount of data to be created via mysql_query()
would pose a problem.
> 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');
I am presuming that when one wants to use
mysql_query("CREATE DATABASE `testdb`")
Firstly I would need to connect via...
mysql_connect('localhost',' root','rootpw');
As i do with all my other queries.
But how do you associate the user (root and rootpw) to the database. this i
usually do within Cpanels MySQL Databases management system. Not done it in
php code before.
[Back to original message]
|