Re: Creating Mysql DB with PHP



"MS" <nospamplaesegr8t_ukuk@xxxxxxxxxxx> wrote in message
news:d81sbd$5st$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> 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.



.



Relevant Pages

  • Re: [ANN] Data Source Name parser (ODBC etc.)
    ... > suggested URL-like strings describing database connections. ... > library for such strings (data source names) is now available at ... raises the exception Syntax_Error. ...
    (comp.lang.ada)
  • Question on how updates to Access tables may or may not cause the database to expand in size
    ... All strings are stored as variable length data, one byte for each actual character and one overhead byte. ... When a database is compacted and repaired, tables are written out in primary key sequence. ... I have concluded that after the compact/repair, that each table, is written in sequence, filling up 2k pages, and that tables are not generally intermixed except at the end of one table and the beginning of the next. ... then the database DOES expand in size. ...
    (comp.databases.ms-access)
  • Re: Japanese to Unicode characters
    ... Oracle-Rdb database; a VB application running on a Window98 Japanese PC ... store the japanese strings as Unicode. ... UniToolBox component for VB which handle the Unicode strings. ...
    (microsoft.public.sqlserver.programming)
  • Re: i18n hell
    ... table attributes to UTF-8 only garbage kept adding into the database. ... you using unicode strings or byte strings? ...
    (comp.lang.python)
  • Re: PreparedStatement
    ... It actually depends upon what JDBC driver ... But the "generic database access" class I am using to insert data to the ... to insert Strings into numeric fields (as long as the Strings are numbers, ...
    (comp.lang.java.help)