PDA

View Full Version : Execute sql script from command line to create tables.


icook
4-10-05, 08:53 PM
Hi,
Can someone pelase tell me how to execute a sql script from the command line.

I am trying to set up phpESP and it says for me to run a script called mysql_populate.sql from the command line. As there are about 16 tables I figure it would easier (and safer) to run the script that to create the tables manually.

I am new to this so please any advice would be appreciated.

Below is an extract from the install manual.

Thanks in advance.
Ian Cook :)

b. Tables and Data

Once a database and user have been created for phpESP, you must
create and populate the tables for phpESP. You will find a
script names "mysql_populate.sql" in the same location as the
last script. This script should be executed on the new phpESP
database as the root user in mysql. As above, you may run this
script using an administration tool of your choosing.

Note: The recommended and supported method of executing these
scripts is via the mysql CLI (command line interface). For
example, to run these scripts you would execute the following
commands:

$ mysql -u root -p < scripts/db/mysql_create.sql
$ mysql -u root -p phpesp < scripts/db/mysql_populate.sql

If you use a database name other than "phpesp", substitute
that name on the second command line.

Gorkfu
4-10-05, 09:13 PM
You can do this in phpmyadmin.

1. Select your database on left.
2. Hit SQL tab at top.
3. Copy and paste the sql query you have into the box and hit go.

Also can upload SQL files to add to your DB.

It should go through flawlessly.


Ryan

icook
4-11-05, 01:18 AM
Excellent!
That worked very well.
Thanks for the advice!!!!

Ian :)