So when I run this script
mysql -h $mysqlhost -u$mysqluser -p$mysqlpass --database=$mysqldatabase -se "INSERT into $mysqldatabase.$mysqltable (prodID,mergePerformed,mergeStartdate) values ($prodID,'Merge - ${FIX_VERSION} ${BRANCH_TO_MERGE} to ${PROJECT_NAME} trunk', now())";
I get this error
ERROR 1064 (42000) at line 1: 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 ''Merge - ${FIX_VERSION} ${BRANCH_TO_MERGE} to ${PROJECT_NAME} trunk', now())' at line 1
Anyone have any thoughts as to why this is...it works when there aren't any variables in jenkins.
Can`t see anything wrong as it stands, as xQbert says it is most likely to be some of your variable substitution.
MySQL syntax errors usually quote the text just after the error, so I would take a look at what is going into $prodID as it is the most likely culprit.
Related
When trying to switch to another user from root I am getting the below error. But most of the examples show this is right syntax. Could you please help me?
Error:
You have an error in SQL syntax; check the manual that corresponds to your mysql version for the right syntax to use near 'mysql -u bcs_fms -p'
You have to execute this command from CLI, not from the mysql console.
There are times that when you are importing a mySQL dump, it would break due to syntax, etc. Currently working on a very large database, running:
mysql -u root -p database < import.sql
will only verbose
ERROR 1064 (42000) at line 116238: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 389
looking at line 389
http://i.imgur.com/RX2osSD.png
won't be much help since its not the actual line the SQL is currently executing (it ignores some comments, etc.)
So, to be in general, what is the best way to debug? How to know the actual line causing the issue?
Hope somebody can help thanks!
I am running my store under Xcart and I get following error on top of web browser:
INVALID SQL: 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 'OPTION SQL_MAX_JOIN_SIZE=1073741824' at line 1
SQL QUERY FAILURE:SET OPTION SQL_MAX_JOIN_SIZE=1073741824
INVALID SQL: 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 'OPTION SQL_BIG_SELECTS=1' at line 1
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
INVALID SQL: 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 'OPTION SQL_BIG_SELECTS=1' at line 1
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
what cause this so I can clear the error?
thanks!
It seems your MySQL server has been updated.
Replace all strings like
'SET OPTION SQL_MAX_JOIN_SIZE'
to these
'SET SESSION MAX_JOIN_SIZE'
A command for the unix-based hostings
sed -i 's/SET OPTION /SET SESSION /' $(grep --include='*.php' -rl 'SET OPTION ' ~/www/xcart_4_6_x)
It needs to check the xcart php scripts where this query is executed and OPTION to be replaced with SESSION for the errors like
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
Also, as for
SQL QUERY FAILURE:SET OPTION SQL_MAX_JOIN_SIZE=1073741824
it might worth to change it just to db_query("SET max_join_size=1073741824");
It works for some xcart installations so please report if it helps to your project as well, thanks
I am trying to port a database from mysql 5.7 to mysql 5.5.
At first, I used the following command
mysqldump -u root -p --all-databases > alldbs.sql
When I try to import the DB in mysql 5.5 I keep getting errors like
ERROR 1064 (42000) at line 572: 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 'STATS_PERSISTENT=0' at line 9
where it complains about STATS_PERSISTENT=0 statement.
Then I tried
mysqldump -u root -p --compatible=mysql40 --all-databases > alldbs.sql
but this just gives me
ERROR 1064 (42000) at line 26: 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 'TYPE=InnoDB' at line 22
where it complains about TYPE=InnoDB statement, which should be ENGINGE=InnoDB. Even with the --compatible option it still keeps the STATS_PERSISTENT statement.
Is there a way to port a mysql 5.7 database to mysql 5.5?
UPDATE
To be clear on my question, I am looking for relialble, i.e. no-hack way, to port the database. I already tried to replace TYPE with ENGINE, remove STATS_PERSISTENT etc. Something else always came up. I am not willing to jump through those hoops everytime I port the database. I am looking for a reliable way via mysqldump or a similiar tool to do the job.
If this is not possible then I will have to switch to an alternative DB.
In console I am trying to drop database using command
drop database database_name;
But it's throwing the below error.
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 'database check' at line 1
I also tried to use another command:
mysqladmin -u root -p drop check;
It is throwing an error below
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 'mysqladmin -u root -p drop check' at line 1
How to fix it?
CHECK is a reserved word in MySQL, you should use back-tick character to escape it:
DROP DATABASE `check`;
In future, try to avoid using reserved words as names of tables/databases to prevent such things from happening.