Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Error 1064 - Import Error

Tags:

import

sql

mysql

I exported a database as a backup that was working fine. When I imported the database to the same exact server, folder, etc. I got this 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---- eNo1jUEKwjAURIXu/inmADHkpwYxu1JCu0iTmFQ9gYtushP09qaCs3oMjxmXc8wWI2PU8C5YMDSY qayt7oiWT7l6CyON7NWxV5LpVjJiERgmF1aBu2vmY6sY5xwX11Ql9YXSMlicGhtKc9otEcs+1Es+ w2/19SY/hMniWen3Qd3hny8nMiDI ----END CUT---- ----BEGIN RAW---- ERROR: C1 C2 LEN: 1 2 11 STR:

MySQL: 5.5.30-30.1 USR OS, AGENT, VER: Win CHROME 5.0.29 PMA: 4.0.5 PHP VER,OS: 5.3.17 Linux LANG: en SQL:
----END RAW----

SQL query:

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

The only problem seems to be that my index page is missing content, the main content actually. All of these files are .sql.

I then dropped all my tables and imported the original database from April of last year. Obviously, this database is missing all the account info, order info, etc. for all my customers as well as all the changes that have been made to my products.

When I compare the two databases the first 11 lines seem to be the problem but I don't know how to fix it. The first 11 lines of the file that DO NOT WORK are:

-- phpMyAdmin SQL Dump
-- version 4.0.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 22, 2013 at 01:28 PM
-- Server version: 5.5.30-30.1
-- PHP Version: 5.3.17

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

The first 11 lines of the file that DOES WORK are:

-- phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 09, 2012 at 05:50 AM
-- Server version: 5.1.61
-- PHP Version: 5.2.17

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

I hve tried to simply copy and paste the 11 lines from the working file to the file that does not work and get another error.

I know this is a long post and I apologize but I have been struggling with this for hours and really need some help.

Thanks

like image 971
210 USA Avatar asked Sep 25 '13 11:09

210 USA


People also ask

How do I fix error 1064 42000?

The ERROR 1064 (42000) mainly occurs when the syntax isn't set correctly i.e. error in applying the backtick symbol or while creating a database without them can also create an error, if you will use hyphen in the name, for example, Demo-Table will result in ERROR 1064 (42000). Now database is created successfully.

How do I import a database into MySQL?

Importing a database from a fileOnce connected to the database go to Data Import/Restore. Choose the option Import from Self-Contained File and select the file. Choose the destination database in Default Schema to be Imported To and then click on Start Import.

What is the error in MySQL syntax?

During application update an error message containing "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 ..." appears in the log. It means your database is outdated and it can't work with the request our application sends to it.


2 Answers

OK, so here is what I found, finally. When I opened the file that was giving me the error in notebook+, the last line, of course, had the following:

ETXNULNULNULNULNULNULNULNULNUL

The original working database when opened did not have any of these characters.

When I simply deleted the last row of the file that was giving me the error and imported the database, everything worked fine. However, my homepage was still not being pulled up properly. I applied a workaround for now and will try to figure that out later.

I hope this helps someone.

like image 153
210 USA Avatar answered Sep 20 '22 03:09

210 USA


I had the same problem when exporting my database for a Joomla 2.5 site. It has something to do with the compression in phpmyadmin. I changed the compression from "none" to "zipped" before exporting the database and that solved it.

Hope that helps!

like image 39
Erika Avatar answered Sep 24 '22 03:09

Erika