hi i am using windows 7, xampp
. i am trying to run a sql file using CMD ut it gives me an error
ERROR:
Unknown command '\x'.
this is what i am doing
this command is not working
mysql> SOURCE C:\xampp\htdocs\elephanti2\db\mas_gis_city_ip.sql;
*** one other problem with this works fine when i tried by go to phpmyadmin and import the file .
why this happening , i have no idea , please help ..................
My original answer:
mysql> SOURCE C:\\xampp\\htdocs\\elephanti2\\db\\mas_gis_city_ip.sql;
You could also try executing the command like this:
mysql> SOURCE C:/xampp/htdocs/elephanti2/db/mas_gis_city_ip.sql;
(Source: a comment in the reference manual suggests using forward slashes on Windows machines)
Try quoting your file name. Notice your command:
mysql> SOURCE C:\xampp\htdocs...
is probably being interpreted as:
mysql SOURCE C: \xampp \htdocs...
(see the \x there?)
If you quote the file name, I bet it'll work. (not sure if mysql requires ' or " for quoting filenames in this context, try both)
Actually this worked. I think it is dwuff's previous answer.
mysql> SOURCE C:\\xampp\\htdocs\\elephanti2\\db\\mas_gis_city_ip.sql;
I had the same problem recently trying to install FossTrak, and this was the syntax that worked on windows 10, with Mysql 5.7
\. C:/share/epcis-repository-0.5.0/epcis_schema.sql
using \source did not, and neither did \\, and by accident i removed the ; and it worked.
Related
After a clean install of Windows 10 when I started to use MySQL workbench I have this error when I try to dump a database.
I could not find anything about it anywhere, the only thing I find are problems with phyton, but nothing related with Workbench.
Output after dumping a database:
08:29:00 Dumping foo(all tables)
Error executing task write() argument must be str, not bytes
08:29:01 Export of b'C:\\Users\\erick\\Documents\\dumps\\Dump20210121 (2).sql' has finished
And the output file is in blank, some ideas?
You can disable (uncheck) the option create schema. It is annoying but it works.
If you have the latest MySQL Workbench (8.0.23), just uninstall and install MySQL Workbench 8.0.20. That worked for me.
Another workaround to this issue is to edit wb_admin_export.py.
In dump_to_folder (line 1679) replace
self.out_pipe = open(path,"w")
with
self.out_pipe = open(path,"wb")
In dump_to_file (line 1957) replace
self.out_pipe = open(self.path,"w")
with
self.out_pipe = open(self.path,"wb")
If you a using version 8.0.23, update to 8.0.25 or above.... it will fix this issue
I have a file that is filled with statements that appear like the following:
update table set column1=NULL where column2 in (select id from users where user_id in ('user1','user2'));
As you can see this is correct syntax. When I run this command manually on the mysql command line it works as intended.
However when I attempt to source the file I get syntax errors. Has anyone seen this issue before? I'm looking for a resolution...
mysql> \! source /tmp/update_users.sql
/tmp/update_users.sql: line 2: syntax error near unexpected token `('
/tmp/update_users.sql: line 2: `(select id from users where user_id in ('user1','user2'));'
You have to use the MySQL source command:
mysql> source /tmp/update_users.sql
When you use \!, you instead invoke a shell command. The shell source command expects a shell script, not a sql file.
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).
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...
I'm a student of bioinformatics and I am using the OrthoMCL tool using this command
./orthomclLoadBlast my_orthomcl/orthomcl.config my_orthomcl/similarSequence.txt
but I am getting the error
Can't connect to data source ' :mysqllocalinfile=1' because I can't
work out what driver to use (it doesn't seem to contain a
'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at
/home/linux/Desktop/orthomclSoftware-v2.0.9/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm
line 56
DBI is already installed in my system, so why is it giving this error? How do I solve it?
You need database drivers to be installed for the DBI module to work with your database. In this case it looks like you need to install DBD::mysql.
It is possible that OrthoMCL omits the driver name and uses just dbi::, in which case you must set the environment variable DBI_DRIVER to mysql.
The proper answer must be in the documentation for OrthoMCL. Have you read it?
Update
Looking at the source for orthomclLoadBlast it looks like your config file is faulty. There is a chance that someone here is familiar with the utility, but you must publish orthomcl.config to stand a chance of getting any useful advice.
you should use mysql for the driver:
sample:
use DBI;
$dbh = DBI->connect('dbi:mysql:DBNAME','root','password')