Update query suddenly stopped working after migration on Unix server - mysql

a program that worked until a few days ago today gave back the following error in Production environment :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntaz to use near', owner='user#domain', check_datetime=NOW(), WHERE id = 26922 at line 1.
the complete query is :
**UPDATE anomalie_ordini.taa_tb_overview_rapporti
SET status_rapporto_id= <val_num>, owner='<val_char>', check_datetime=NOW()
WHERE id=<val_num>**
the same query run in Development environment without problems.
Could be tied to a migration of the server where the query runs?
Hope you can help me.
Thank you.
EDIT: find the error, one of the columns were named ROWS, a reserved word (not my choice :) )

Related

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

MySQL Workbench / Forward Engineering Progress - Error

So i have a little problem while learning MySQL/PHP.
I have installed XAMPP and the MySQL Workbench, in order to learn (play around) some basic SQL/PHP stuff.
My XAMPP shows that my SQL server is up and running (it clearly says MySQL), but nonetheless, i get an error, each time i try to implement a schema on my sql-server.
As for now, i have only used the EER/Forward Engineering method of implementing a database with the MySQL-Workbench. Each time i try to complete the process after modelling the EER model, i get errors like this:
Executing SQL script in server
ERROR: Error 1064: 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 ')
Does anyone here have an idea how to fix this?
Greetings.
Thats what the generated SQL looks like
I also tried setting the "Target SQL Version" in the Model preferences to 5.6, as well as overall preferences.
As a little desperation move, i deinstalled XAMPP and the MySQL Workbench, and installed the newest versions - XAMPP (7.3.8 , using MariaDB) and the Workbench (8.0.17)
What am i missing?

SQL - Connection Deletion

I'm trying to delete all connections to a database, because I made a mistake and forgot to place mysqli_connect($con) in a number of pages.
On StackOverflow I found the following question: How do you kill all current connections to a SQL Server 2005 database?
However, when I use the following query, I get an error in phpMyAdmin:
ALTER DATABASE `dotnettv_db` SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
Error:
#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 '[`dotnettv_db`] SET SINGLE_USER WITH ROLLBACK IMMEDIATE' at line 1
I would appreciate it if you could tell me what I am doing wrong. Thanks!
EDIT: This is what I am getting in phpMyAdmin: http://oi43.tinypic.com/2v0k8rc.jpg - one process, around 50 connections. The biggest problem is with the traffic associated with these connections - 3.3 Terabytes and counting in 6 days: http://oi41.tinypic.com/2lj6n9t.jpg
You are not using SQL-Server (from Microsoft) but MySql so the SQL-Command won't work.
Check this for help: how to kill mySQL connections

Error code 1064, SQL state 42000: You have an error in your SQL syntax;

I'm using latest version of MySQL ==> mysql-5.6.10-winx64.zip
Created the database and every thing is ok 'I think'
when I try to execute this simple command;
"select * from family"
I got this error :
Error code 1064, SQL state 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 'OPTION SQL_SELECT_LIMIT=DEFAULT' at
line 1
I've spent much time searching for a solution but no solution was found :(
That looks like an error coming from a JDBC driver. When the JDBC driver initializes the connection, it sends several commands to the MySQL server, one of which is:
SET OPTION SQL_SELECT_LIMIT=DEFAULT
The problem is that the SET OPTION syntax has been deprecated for some time and is now no longer valid in MySQL 5.6. Here's a relevant bug conversation from MySQL's bug database:
Bug #66659: mysql 5.6.6m9 fails on OPTION SQL_SELECT_LIMIT=DEFAULT
Try upgrading your JDBC MySQL driver. The bug conversation lists some other options in case upgrading the driver is not an option.
I followed the instructions above and this worked for me!
Download latest jar file from here:
http://dev.mysql.com/downloads/mirror.php?id=412737
Unzip it
Copy jar file "mysql-connector-java-5.1.25-bin.jar"
to this folder: C:\Program Files\NetBeans 7.3\ide\modules\ext
In Netbeans IDE: Disconnect from database.
Click Services. Expand Drivers. Right-click on MySQL and press Customize.
Add latest driver
Remove previous driver.
Re-connect to dabatase within IDE.
I had the same problem few weeks back. Followed the following steps and it very much resolved the issue.
Copied the latest version (mysql-connector-java-5.1.23-bin) of the jar file to ..\NetBeans 7.3\ide\modules\ext. My earlier version of the driver was mysql-connector-java-5.1.18-bin.
Change the driver version within NetBeans IDE. In the IDE's Services window, expand Drivers -> right-click on MySQL (Connector/J driver) and select Customize. Remove the earlier driver and point it to the latest one (C:\Program Files (x86)\NetBeans 7.3\ide\modules\ext\mysql-connector-java-5.1.23-bin.jar). Click ok and restart IDE.
This should resolve the problem.
If the driver suggestion does not work, check your sql for unprintable characters. I just spent an hour troubleshooting this issue only to discover a hidden u+200b character at the end of my sql statement.
I got the same Error when i was dumping mysql table structure file in to DB. Mistake was putting the Syntax for dropping all table before but not checking their existence in the Database.
Issue was at " DROP TABLE usermgmt".
I removed that code of lines of dropping tables and it proceeded with out any error this time.
I prefixed the name of the table with the database name such as
select * from database_name.table_name;
and it worked perfectly, so most likely there's a name conflict.

OpenCart on Windows XP Error

I'm trying to install Open Cart on my virtual machine with, PHP 5.4.7, MySQL 5.5 and Apache 2.2. After A LOT of troubles, I've managed to arrive at the moment of installation script execution, but I receive this problem:
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 '/*!40101 SET #OLD_CHARACTER_SET_CLIENT=##CHARACTER_SET_CLIENT */' at line 1
Honestly I'm stuck. I've tried to execute the code in Workbench and it works, except that in the INSERT INTO queries for test data they've missed default values for NOT NULL columns.
Hints? Suggestion?
Those random characters at the start of the SQL are the UTF Byte Order Mark. Something you used to edit the file decided to emit that at the start. Quickest way to get rid of it would be getting Notepad++, open the file in that, Select "Encoding->Enocde in UTF-8 without BOM", and resave the file, and try again.