Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loading script to populate database

Tags:

sql

mysql

I am trying to load a script to populate a database. I have created the database and the user, and now I just need to create the tables from the script.

I am using this command from the cmd:

source C:\Temp\filename.sql;

and I either get a message indicating error 2 (that the file cannot be read) or 'No previous outfile available, you must give a file name!'

I have looked over questions relating to this, but have not found a solution.

Please assist, mehmeh

like image 889
mehmeh Avatar asked Mar 07 '26 03:03

mehmeh


1 Answers

In MySQL, backslash is the escape character. So, in your path, replace backslashes by slashes or double backslashes. This gives

SOURCE C:/Temp/filename.sql;

or

SOURCE C:\\Temp\\filename.sql;
like image 107
Éric Guirbal Avatar answered Mar 09 '26 15:03

Éric Guirbal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!