Mysql syntax errors on import - mysql

I need some help with mysql errors keep popping up. Some time ago I could easily export (mainly WordPress) databases from my localhost and import these (via phpmyadmin import) on the webserver to push my websites live. Since a few days I keep getting different mysql error while importing these databases..
I tried a couple of things, changing charactersets, collate settings, ... Nothing seems to work.
I'm not a DB guy, so maybe this is something easy, but I can't seem to figure it out on my own..
Local (xampp on mac)
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.6.26 - Source distribution
Protocolversie: 10
Gebruiker: root#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Webserver
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.5.31 - MySQL Community Server (GPL)
Protocolversie: 10
Gebruiker: t2c_projects#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Can someone please help me out? I can give all the info needed, don't know which are relevant.. So anyone need additional info please let me know.
Any help is welcome!
Update1:
Errors I'm getting
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
This error is from a database in development, I tried a fresh installation db import and then I'm getting this:
#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 'CREATE TABLE `wp_termmeta` ( `meta_id` bigint(20) UNSIGNED NOT NULL, `term_i' at line 11
I keep getting different syntax errors, I allready tried manually fixing these but they just keep me changing stuff so I'm trying to fix this core issue..
I have a suspicion it has something to do with mysql versions or character sets..
Update2:
So I tried fixing the first (mixed html) error, and after I removed all \' by ", I get new errors (83 errors):
#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 '2016-03-29 10:21:45', '0000-00-00 00:00:00', ' ', '', '', 'draft', 'closed', 'cl' at line 5

It simply seems that your SQL statements are mixed with HTML at some point
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
If you believe that it is not the case (e.g. you insert html in rows), please add the full queries to your post, but the issue seems pretty obvious :)
Maybe that some copy/paste manipulation error led to that state.
Without checking the full statement that causes the error, can't say more at the moment..

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 error #1064 in Drupal

I have a problem when I upload mysql from localhost to my server. The error message show like below.
Error
Static analysis:
1 errors were found during analysis.
A closing bracket was expected. (near ")" at position 76)
SQL query:
CREATE TABLE actions ( aid varchar(255) NOT NULL DEFAULT '0'COMMENT )
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 3
enter image description here
Please help me. how to fix this error....
I just try many ways to solve mysql error. Fortunately, I found the ways to fix it. Just update phpmyadmin version in localhost to be the same at server version.
Then, it's worked for me.
Hope this way help you to solve your error when you get the same at me.

SQL syntax error in MySQL unsing a cast(Partition as Signed)

I have to support an application on a MySQL server. I can´t change the source code so I can´t change the used syntax.
My problem is that I always get an syntax error like this:
Microsoft OLE DB Provider for ODBC Drivers [-2147217900]
[MySQL][ODBC 5.1 Driver][mysqld-5.6.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 'Partition as Signed)' at
line 1
I looked into the log file and found the problem in this line:
Select *
from XYZ
where `Type`='something'
and Client='{3DBEA33A-9F0A-4e86-8354-F652713EA458}'
order by Cast(Partition as Signed);
I always get this error when the "Cast(Partition as Signed)" appears.
Is there any way to configure the server to accept this syntax?
I´m using MySQL (x64) 5.6.26 with InnoDB.
Partition is reserved word.
http://dev.mysql.com/doc/refman/5.6/en/keywords.html
you should use it with backticks
`Partition`

MySQL Workbench export error

I designed a mysql database with Mysql Workbench and exported it as SQL commands. Then executed them on phpmyadmin. This is what happened:
#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 'Disable',
`tabeiat` TINYINT NULL COMMENT 'Disable',
`Khedmat` TINYINT NULL' at line 17
What's the problem with comments? Are they supported?
PHP Version 5.3.29
MySQL Version 5.5.40-cll
Thanks
I created multiple line Persian comment in workstation that added an infected character in the commands.
This is the generated code:
And this weird character generated sql error :)

#1064 error in importing database php mysql localhost

I have backup of my live site's database. I want to run it on localhost. I tried to import the back up database that I craeted in phpmyadmin/localhost. But I am getting error something like this:
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 '
"http://www.w' at line 1
Can Any one help me....
This doesn't look like an SQL file, but as Krister Andersson suggested, you should post a few lines so we can see exactly what you are dealing with. How did you create the backup? What file type does it claim to be (is there an extension on the file)?