#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    2
    Rep Power
    0

    Failed To Open File 'file_name.sql', error: 2


    Hi,

    I'm new to mysql and I'm having trouble running a batch file. I am on windows 2000 pro and I'm running mysql version 4.0.18.

    I am logged into the server as root. When I enter the command:

    mysql> source my_file_name.sql

    I get this:
    ERROR:
    Failed to open file 'my_file_name.sql', error: 2

    I've tried moving the 'my_file_name.sql' into various directories without any luck. Can anyone tell me what I'm doing wrong here?

    Thanks, Adam
  2. #2
  3. Hockey face
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    St. Catharines, Canada
    Posts
    8,144
    Rep Power
    1316
    I don't do batch files, but don't think you can run them like that from the mysql command line. most likely you have to run from your dos or command prompt
    Code:
    c:/mysql/bin/mysql -uusername -p123456 my_file_name.sql
    or something similar should work
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    64
    Rep Power
    12
    I have no experience with the windows version of mysql, but i think the linux version acts the same..

    I guess that your mysql is in an search path so you can type it anywhere you are.

    Go to the directory where your sql file is located and from there start mysql

    Another way is to give the full path where you located the file. I dont know how mysql will handle space in the directory names.

    Greetz,

    Ronald
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    2
    Rep Power
    0
    Hi Ronald,

    Thanks, yes, typing the full path worked. Clearly it is a problem with the path. Strange because I read in the manual that the path is supposed to default to /data/Name_of_database folder but that didn't seem to work.

    OK, thanks again.
    Adam
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    64
    Rep Power
    12
    Oh, i am not aware of such a feature...

    Well youre mysql problem is solved!

    Have a good time with MySQL

    Greetz,

    Ronald

IMN logo majestic logo threadwatch logo seochat tools logo