#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    1
    Rep Power
    0
    Hi:

    I want to execute .sql files in mySQL. Is there any similar commands to Oracle's run or @? Kindly help me

    Bye
    Sangeetha
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    15
    The only way I've found of executing a SQL script in MySQL is to pass it in as standard input when starting the mysql client. So, to run mydml.sql, do:
    mysql -uusername -ppassword <mydml.sql

    This is something of a crap solution as you can't invoke a SQL script from within the client, so I figure there must be a better answer out there, but I'm buggered if I can find it.
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    That's pretty much the correct way to do it, but you have to pass the database to use, also, unless it's created in your .sql file...

    mysql -uuser -ppass database < file.sql

    ---John Holmes...

Similar Threads

  1. Help Needed With MySQL Search...
    By CoasterLine in forum PHP Development
    Replies: 5
    Last Post: January 25th, 2004, 12:23 AM
  2. Way to load files with different names into MySQL?
    By abrahamvionas in forum MySQL Help
    Replies: 1
    Last Post: January 19th, 2004, 10:59 PM
  3. MySQL and SSH - help needed
    By windf4ll in forum MySQL Help
    Replies: 5
    Last Post: January 15th, 2004, 10:41 AM
  4. sendmail installation problem on Linux
    By abuschr in forum Linux Help
    Replies: 0
    Last Post: January 14th, 2004, 10:08 AM
  5. PHP script to execute MySQL create table
    By sisleysusie in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 05:44 AM

IMN logo majestic logo threadwatch logo seochat tools logo