MySQL: Source Error 2? No File Found

13,029

Solution 1

Try like this:

mysql> source c:/dumps/mydatabase.sql

That is, use forward slash instead of back slash

Solution 2

I think that the sql process might not have read access to your directory anyway. In which case, you might have to copy the sql file to other accessible folder and tell mysql the absolute path.

Solution 3

You need to restart mysql if you have copied file after starting mysql server.

also if you have space in file or folder name you should use quotes.

Solution 4

Remove spaces in the folder names of the path, It worked for my mac path.

(Eg: change the folder name MySQL Server 5.1 to MySQLServer5.1)

Share:
13,029
user2966886
Author by

user2966886

Updated on June 05, 2022

Comments

  • user2966886
    user2966886 almost 2 years

    When I tried to source for a particular .sql file, namely 'registrar.sql', the following error is displayed:

    Failed to open file 'registrar.sql', error: 2
    

    I know that this means the below error:

    #define ENOENT       2  /* No such file or directory */
    

    However, I am not sure how to be more specific as I have tried entering 'source registrar.sql' and I have tried entering the absolute path. Now it is possible I am just entering the absolute path incorrect which is where I could use some help. Here is the path in properties in windows.

    C:\Program Files\MySQL\MySQL Server 5.1\bin

    File name is: registrar.sql

    Any help on this would be appreciated.

  • Félix Adriyel Gagnon-Grenier
    Félix Adriyel Gagnon-Grenier over 8 years
    what do you mean? I'm not sure we really need to restart mysql after importing an sql dump file...
  • mandza
    mandza over 8 years
    @FélixGagnon-Grenier we are not, but sometimes mysql cache old data. This is not actual solution but few times I solved same problem like this.