Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running Mysql batch file

I have a .sql file on my computer at C:\Users\Owner\Documents\file.sql (Windows Vista) that just creates a database and a simple table within. In mysql at the command line i enter

source C:\Users\Owner\Documents\newbie.sql;

the query seems to work ok but just before it shows me the successfully created table it outputs the following errors that seem to be related to how i entered the file name:

ERROR:
Unknown command '\U'.

ERROR:
Unknown command '\O'.

ERROR:
Unknown command '\D'.

ERROR:
Unknown command '\n'.

Pardon the newbie error...whats the fix?

Thanks!

like image 939
algorithmicCoder Avatar asked May 06 '11 00:05

algorithmicCoder


People also ask

How do I run MySQL in batch mode?

To do this, put the commands you want to run in a file, then tell mysql to read its input from the file: shell> mysql < batch-file If you are running mysql under Windows and have some special characters in the file that cause problems, you can do this: C:\> mysql -e "source batch-file" If you need to specify connection ...

Does MySQL support batch?

MySQL supports two types of batch loading.

What is MySQL batch mode?

The MySQL monitor can be used in interactive mode or in batch mode. In interactive mode, you type in SQL queries or MySQL commands such as SHOW DATABASES at the MySQL prompt, and view the results. In batch mode, you tell the monitor to read in and execute a list of commands from a file.


1 Answers

Try using forward slash / in place of back slash \ in file path:

C:/Users/Owner/Documents/newbie.sql

or put it between double quotes (")

like image 155
manji Avatar answered Oct 08 '22 20:10

manji