Results 1 to 3 of 3

Thread: Execute sql script from command line to create tables.

  1. #1
    Registered
    Join Date
    Jun 2004
    Location
    Perth, Western Australia
    Posts
    22
    Rep Power
    0

    Question Execute sql script from command line to create tables.

    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.

  2. #2
    Perplexed Person Gorkfu's Avatar
    Join Date
    Jan 2005
    Location
    Pacifica, CA
    Posts
    328
    Rep Power
    13
    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
    Confusion is bliss

    Did I mention my brain hurts?

    phpCheckZ - The RSWR Network - UPC Food Search - The Organic Food Database

  3. #3
    Registered
    Join Date
    Jun 2004
    Location
    Perth, Western Australia
    Posts
    22
    Rep Power
    0
    Excellent!
    That worked very well.
    Thanks for the advice!!!!

    Ian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •