Error when running Mysql batch file - mysql

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!

Try using forward slash / in place of back slash \ in file path:
C:/Users/Owner/Documents/newbie.sql
or put it between double quotes (")

Related

UnicodeEncodeError occurs when attempting to migrate MSSQL data to MariaDB with MySQL Workbench

I'm trying to move data from SQL Server to MariaDB using MySQL Workbench.
I installed it as 8.0.27 version at first, and after the problem occurred, I downgraded it to 8.0.26 version, but the problem was not solved.
I'm confused whether it's a problem with the data you're trying to move or something that's happening in MySQL Workbench.
I tried googling, but there was a similar phenomenon, but I couldn't find an answer.
https://bugs.mysql.com/bug.php?id=105772
Can you give me some advice?
thanks you.
------------------------------------------------------------------ Starting... Create Script File...
Traceback (most recent call last): File "C:\Program
Files\MySQL\MySQL Workbench 8.0
CE\workbench\wizard_progress_page_widget.py", line 71, in run
self.func() File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\migration_schema_creation.py", line 188, in
_create_script_task
self.main.plan.createTargetScript(self.main.plan.state.objectCreationParams["CreateSQLFile"])
File "C:\Program Files\MySQL\MySQL Workbench 8.0
CE\modules\migration.py", line 527, in createTargetScript
grt.modules.DbMySQLFE.createScriptForCatalogObjects(path, self.migrationTarget.catalog, self.state.objectCreationParams)
SystemError: UnicodeEncodeError("'charmap' codec can't encode
characters in position 99-104: character maps to "): error
calling Python module function DbMySQLFE.createScriptForCatalogObjects
ERROR: Error during Create Script File: UnicodeEncodeError("'charmap'
codec can't encode characters in position 99-104: character maps to
"): error calling Python module function
DbMySQLFE.createScriptForCatalogObjects ERROR: Exception in task
'Create Script File': SystemError('UnicodeEncodeError("'charmap'
codec can't encode characters in position 99-104: character maps to
"): error calling Python module function
DbMySQLFE.createScriptForCatalogObjects')
Failed
enter image description here
If you are seeing \uFFFD, that is the REPLACEMENT CHARACTER - - �
It means that the data was already corrupted beyond repair. Go back a step in the process of the data to see what first led to it.
See also "black diamond" in Trouble with UTF-8 characters; what I see is not what I stored to find some ways that it can occur purely in MySQL. However, it sounds like SQL Server created it; I think the problem is back there.
Fetch the hex for any characters involved, noting that \uFFDD (UTF-8 hex: EFBFBD) is after things are already corrupted.
In UTF-8 (MySQL's utf8 or utf8mb4), Hex EAB0zz through ED9Ezz is used for Hangul (Korean). For example, 박상우 is hex EBB095 EC8381 EC9AB0 (minus the spaces).

Failed to open file, Error 2 - MySQL Import

I'm trying to import a MySQL Database via command line (Terminal). The file's path seems to be correct, but I keep getting an error message that is most likely showing that, the path of the SQL file I'm importing is not correct. Below is the sample of the command line I'm using and the error I'm getting...
NOTE: Linux Server, Centos 7 - MariaDB
source C:/Users/localcomputerUser/SQLFileFolder/SQLFile.sql
source C:/Users/localcomputerUser/SQLFileFolder/SQLFile.sql
Failed to open file 'C:/Users/localcomputerUser/SQLFileFolder/SQLFile.sql
', error: 2
Thanks for your support.

mysqlWorkbench Error : Unhandled exception: new-line character seen in unquoted field

Can anyone please help fix this Error?
Task: I am trying to import data from a csv file
mysqlWorkbench Error : Unhandled exception: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? Check the log for more details.
Resolved:
All I had to do was to save the ccv file as a Windows csv even though I was doing so from a Mac.

Mysql: "\." doesn't work?

I was trying to upload an .sql file to mysql console with \. but it throwed me:
mysql> \. /home/krest/s.sql;
ERROR:
Failed to open file '/home/krest/s.sql;', error: 2
However, "source" command works properly!
What I am doing wrong?
I am running console through ubuntu 14.04 terminal.
Look closer to the error message, everything you need to know is there:
Failed to open file '/home/krest/s.sql;', error: 2
Error 2 is "No such file or directory". You can use the perror command line tool to find out the message from an error code returned by MySQL.
Did you figure out what's wrong? The semicolon after the file name is not supposed to be there. MySQL thinks it is part of the file name and this is why it cannot find the file.
As a side note, it seems that some of the short commands work if the ending semicolon is preceded by a space and do not work without the space (\u, for example, works this way). Others take everything until the end of line as parameter (and fail with an error because of the ending semicolon).

Errors during import of sql file to MySQL database

I am new to database and have just started to learn MYSQL. I have downloaded a sql file called rating.sql and would like to import it to the MYSQL database installed on the local machine. The operation system is Windows 7. The path for the sql file is:
"E:\rating.sql".
I am using the following commands in the MySQL Command Line Client
mysql>use database_name;
mysql>source E:\rating.sql;
The system gives the following error message:
ERROR 1049 <42000>: Unknown database 'ating.sql'
It is definitely something related to the path. Can anyone explain how this error is generated?Thanks
You have use \ and this is an escape character (omits the immediate following character. So to fix this you can use \ instead.
mysql>resour E:\\rating.sql;
Mysql recognises \r as an escape for a carriage return character.
To make it simpler, could you rename your file to something beginning with another letter...mustn't be b n r t or z...