Re: Creating Mysql DB with PHP



> > 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.


.



Relevant Pages

  • Re: Executing PHP files on remote web server
    ... We have a commercial web host servicing our external clients, but we don't want to move the entire app and database to the web host because a lot of the data is sensitive. ... By loading the non-sensitive data into the web host's MySQL tables, our external clients can see their reports on the web. ... our web host put a firewall on the MySQL database so we can't insert data into the remote tables directly from the PHP pages running on our own web server. ...
    (comp.lang.php)
  • Database Comparison?
    ... after using it that php is built more than anything to easily sit on ... talking to a mysql database and spitting out html to ... use these things better I've made a rudimentary gui designer and some ...
    (comp.lang.php)
  • Re: How to use SQL "LIMIT" keyword against an MDB file
    ... that it will work with an MSAccess MDB file. ... PHP Programmer Guy. ... Except you've just "solved" his issue with a database redesign. ... from MySQL to Access in the first place. ...
    (comp.lang.php)
  • Re: help me
    ... field automatically assign its self a value of the next auto inc number ... I have a mysql database and i have it displaying whats currently there ... using php, the problem is that I cannot insert into the database ...
    (comp.lang.php)
  • Re: Help: Dreamweaver Database Conncetion Problem (PHP/MySQL)
    ... You probably can't connect to MySQL from outside the server, ... > on remote machines. ... you can't use Dreamweaver (or any other remote database tool) for ... I can upload my PHP site but the problem is that I ...
    (alt.php)