calling mysql in perl breaks the --tee option? [duplicate] - mysql

Can anyone help me with this? I am currently trying to write my queries to a file and I will eventually close it with notee; call. I have used the tee call before but for some reason today I am having problems.
Here is the syntax in question:
tee c:/trash/test.txt;
select*from customer;
Here is the Error:
Error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem.
ERROR: Unknown Punctuation String # 6
STR: :/
SQL: tee c:/trash/test.txt;tee c:/trash/test.txt;tee c:/trash/test.txt;
SQL query:
tee c:/trash/test.txt;
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tee c:/trash/test.txt' at line 1
The file trash has been created so I know that is not the issue.
Any help will be appreciated thank you.

The tee and notee commands are only available in the MySQL command-line client. They are not handled by the server, so they cannot be used in applications like phpMyAdmin.

Related

Error code: 1064 in MySQL when create SOURCE?

I want to use my SQL'book_data2' file from the desktop E drive as a 'SOURCE'. But I am getting an error code 1064 in MySQL workbench. Could you help me for that issue? I am giving the code and action output below.
Code:
SOURCE E:\DataPractice\Practice\book_data2.sql;
Action Output:
Error Code: 1064. You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'SOURCE E:\DataPractice\Practice\book_data2.sql' at
line 1 0.000 sec
There are a number of commands that are supported by the mysql client (that is, the command-line client, not MySQL Workbench), but they are parsed in the client, not sent to the server as SQL statements. The MySQL Server does not recognize these commands.
It can be confusing, but remember both the client and the server may process commands. You just have to read the documentation to learn which commands are in the list of client-only commands:
https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html
(Except USE, which is recognized by both mysql client and server, just to make sure there's an exception to every rule!)
If you want to use MySQL Workbench to "source" an SQL file, in other words load a file, read the SQL commands in that file, and execute them, Workbench does support this action, but they call it Data Import/Restore. It's documented here: https://dev.mysql.com/doc/workbench/en/wb-admin-export-import-management.html

Sql Syntax error with Doctrine, probably because of change of Mysql version

I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'integer)
BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1
I think, it is probably because of different versions of mysql. Because on localhost it runs without problem
Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution?
thanks
I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok

Error when SQL query called from C program

I want to execute SOURCE data/keyw.sql from C program. This query works fine when I execute from the command line but gives the following error on executing mysql_query(con, "SOURCE data/keyw.sql")
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SOURCE data/keyw.sql' at line 1
Any help would be highly appreciated.
The SOURCE command is not executed on the MySQL server. It is interpreted by the mysql Client, and is basically just a convenience.
Quote from MySQL documentation:
mysql sends each SQL statement that you issue to the server to be executed. There is also a set of commands that mysql itself interprets. For a list of these commands, type help or \h at the mysql> prompt:
Note that source is one of those listed. If you want to know how it works, then have a look at the source code for the mysql Client.
If your source to be executed contains more than one MySQL statement then your connection will need to support multiple statement execution, or alternatively you need to parse the SQL into individual statements yourself.

How download DB MySQL on hosting?

This first that I try to download DB MySQL on "godaddy", but I receive this message:
Error
There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
----BEGIN CUT----
eNrt2c1OwkAUBeBDAQODiSyI67tgYwKlLYLQlRXLXwrUFnFpTERDJIUYMfI6PoHv4HtRp01Al26M
Jt4vM5mb07kzyWxre97IM6mlU8sgxx6apJFOjbrWFP5YftgI4U9kWuzdFsVg7V84JtVUTW3Wy/PF
vbj0PRr5JbI69nBcooktW65mAflW2/J68c5a9US4A8skQ9X1aFSF23WjraWRHx2mq3VyZsHqRTjW
sGPSNCivnu7KDRFftkmI/SSQTwCaXNDFjpJBFkhHZWab5eV8ewfENqhUAAJjjDHGGGOMMcb+OgXh
D5y6h14QLM7P+H0ZY4wxxhhjjLHf9pqI/+n/Wwko6KMtqy4Od6m7q/tIKkrhiL4JKWSXj4vl9cN0
jTRycf18M19NkcoahrwOOJXzIAOkc4UCjr8E4bYz/GwL8QHyNkoe
----END CUT----
----BEGIN RAW----
ERROR: C1 C2 LEN: 0 1 8609
STR: �
SVN: $Id$
MySQL: 5.0.96-log
USR OS, AGENT, VER: Win SAFARI 5.0.537
PMA: 2.11.11.3
PHP VER,OS: 5.1.6 Linux
LANG: en-utf-8
SQL: �
0H ��
// �InnoDB�JFHPJ) prop_keyprop_value 22#4#�prop_key�prop_value�
----END RAW----
SQL query:
� 0H �� // �InnoDB�JFHPJ) prop_keyprop_value 22#4#�prop_key�prop_value�
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'þ
' at line 1
What did wrong I do? I thing this is because version of MySQL, I changed from 5.6 to 5.0.96 and created new table, but receive same result.

Import multiple large sql dump mysql

I want to import several .sql files into database using source command (mysql command line). But when I get this error:
source E:\Progs\Backups\DBs\file01.sql
ERROR:
Unknown command '\P'.
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'sourc
e E:\Progs' at line 1
....
I used source command to import large files hundreds times but now I can not understand what I'm doing wrong. This is my system(I'm using XAMPP (Basis Package) version 1.7.3 :
Windows 7x64
MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc
Any help would be appreciated.
Thanks!
Edit:
I tried this one, but same error:
source 'E:\Progs\Backups\DBs\file01.sql'
MySQL sees the \P in E:\Progs as a command. Because that command does not exist, it complains.
Forward slashes are understood in many cases. Try:
source E:/Progs/Backups/DBs/file01.sql