Error import mysql database - mysql

i export my database and export to another computer use phpmyadmin
but it error,
Static analysis:
2 errors were found during analysis.
Unexpected character. (near ":" at position 53)
Unrecognized statement type. (near "div" at position 1)
SQL query:
<div class="error"><h1>Error</h1><p><strong>SQL query:</strong> <a href="db_sql.php?sql_query=SET+time_zone+%3D+%22%2B00%3A00%22&show_query=1&db=project1&token=9e474724fcd1b27aa482f098f19b22f1"><span class="nowrap"><img src="themes/dot.gif" title="Edit" alt="Edit" class="icon ic_b_edit" />&nbsp
MySQL said: Documentation #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 <div class="error"><h1>Error</h1><p><strong>SQL query:</strong> <a href="db_sql. at line 1

I hade the same error, and I noticed that mysql didn't export all tables database; still can't figure the reason, but I started to exporting and importing the tables as groups
After exporting the tables, you can import them, without any problems.

Your export file clearly contains HTML code and not SQL code. Make sure you export your database properly. You can export your database in phpMyAdmin as follows.
Log into phpMyAdmin
Click the database you are working with in the left menu
Click Export in the top menu
Under the Export heading, ensure that all of your tables are selected and that the SQL option is selected.
Ensure the Save as file option (towards bottom of page) is checked.
Click Go
You will be prompted to either open or save the file. Please select the option to save the file.
-- cited from http://www.inmotionhosting.com/support/website/phpmyadmin/export-database-using-phpmyadmin

I too had the same problem even after downloading in the sql form. My problem was with wp_comments table I exported all the other tables and for wp_comments table I just downloaded the structure only then manually inserted the values. My problem got solved

I had the same problem when I want to migrate my wordpress to a new doamin, so I tried many options;
the best one that fixes my problem is trying exporting/importing database using the command line in the terminal.
Export DB: mysqldump -u usernameDB -p name_DB > /home/file.sql
Importing DB: mysql -u username_newDB -p name_newDB < /home/file.sql
NOTICE ALL COMMAND ARE EXECUTED IN TERMINAL not logged in Mysql DB.

You SQL is not exported properly.

Related

Importing big sql file ends up with [ERROR_RDBMS] exit status 1

I'm trying to import a big sql file (around 10GB) in Google SQL. I have create my instance and had tried so far with MySQL 5.6 and MySQL 5.7 both getting the same issue when trying to import the database: [ERROR_RDBMS] exit status 1. I have tried the user interface method for import as well as the console one (gcloud sql import sql mydb gs://my-path/mydb.sql --database=mydb). Also tried to find more details in Log explorer, but there was no error or anything else be notices for the mysql.err log.
In the same time I manage to connect my MySQL Workbench to the instance and I could see that there where few database tables that were imported. The only import seems that crushed on importing one of the biggest tables which is around 5GB.
Can anyone suggest what might cause this error and how I can find more info about it. Thank you.
I didn't found how to see the error on google console but figure it our that I can import the database through the MySQL Workbench and there I got the full error. If any one know a way to do this on the google cloud I'll accept her/his answer.

Error when importing SQL Dump from an equal source

I need to sync the database of a live server to our development system, so I did create a dump with mysqldump, zipped it, piped it to the other server, unzipped it and wanted to import said dump. Quite the no-brainer, right?
mysql -uroot -pPASS DBNAME < dump.sql
This is where the error occurs.
ERROR 1064 (42000) at line 270: 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 ''{\n \"parsed_parameters\":91,\n \"max_result\":[\n {\"time\":5076987.68,\"outp' at line 1
Edit: This does also happen if I use the MySQL CL with source.
This is odd, as every technical aspect of the live system is equal to the dev system, the only difference is the backend and the data in the database.
So I am wondering why I can't insert this dump despite having a comparable database with the same schema as the source.
Edit: Just for testing I created an empty database and got the same error.
But the thing I don't get is, that the process successfully imported exactly 500 rows with similar values. Maybe there is something with this 500 rows threshold?
You need to login first using below cmd
mysql -u <your-username> -p
After click enter it will asking for password please enter it, then using below you can import dump in specific schema.
use <schema-name>;
source database/filepath/dump.sql;
If you have not created schema then create it using below cmd first after login.
create schema your_schema_name;

Import MySQL database with phpMyAdmin

I'm getting an error:
#1044 - Access denied for user 'host_adminman'#'localhost' to database 'testdb4'
I thing that it should be denied, since the user/pass combo for MySQL 5.6 that was used on my PC while developing DB do not match ones I got from host. I've found explanation from HostGator that:
"The problem here is your import file contains an SQL query that attempts to create a database for the wrong username. Notice the user2 in 'user2_wrdp9' does not match the username1 in 'username1'#'localhost'. Someone must edit the import file and change the old user2 to your new username1.
So, how do I do that?
I have MySQL Workbench installed. Added, the same username as on the host, gave it all privileges to 'testdb4', exported database in a SQL file, but I still get this error when I try to import it on the host.
Did somebody use phpmyadmin to create this import file?
If so, can you get them to do it again?
If so, can they use the "custom-display all possible options" item in the phpmyadmin export panel? That will allow them to uncheck the "Add CREATE DATABASE / USE statement" and redo the export. That should get rid of your problem with the import.
If you can't get the export file remade, you can use a simple text editor (for example, the notepad program on Windows) to fix up the import SQL file.
If the filename ends in .zip or .gz or some such, you need to uncompress it first.
Then open it up in the text editor. Right near the beginning of the file you'll find lines like these:
--
-- Database: `blah_blah`
--
CREATE DATABASE IF NOT EXISTS `blah_blah` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `blah_blah`;
Delete them and save the file. Then try importing it again.

Mysql Error While Importing

I am trying to import Mysql Data taken from Wordpress blog locally on Window 7 system. One way or other it is giving error.
The table wp_commentmeta was giving error. I have deleted all aksimet rows, but still error was coming. So, quit that table and included other tables. But now as well error is coming, which I do not understand:
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---- eNo1jTsKwzAQRAPu9hRzACEs2S6ynRDCDugXSYlPkCKN+9w+ciBTDY/HjCslFYZVsBreRYaChlJU
W8cDUfjUu2cscpGTpkctSFXArC42gafr0v4+YLeSguvWKKeRcjCMufdZKspbPj2R6rnSyRX7LcZG
3sSV8Trod0DD5Z8vxK4ftA==
----END CUT----
----BEGIN RAW---- ERROR: C1 C2 LEN: 1 2 11 STR: MySQL: 5.5.32 USR OS, AGENT, VER: Win CHROME 5.0.30 PMA: 4.0.4.1 PHP VER,OS: 5.4.19
WINNT 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 error is from PHPMyAdmin.
Just a warning message for everyone. I remember, I used to use command line more than any tool like phpMyAdmin. Today phpMyAdmin has taken so many hrs. phpMyAdmin was not exporting correctly and all problem was due to that.
Not even phpMyadmin could import its own exported data. I used mysqldump and then mysql ... db < sql.sql and it worked at lightening speed.
#mysqldump -u userName -p --add-drop-table --insert-ignore --result-file downloads/db_name_dump-oct-14.sql db_name
Then downloaded the file using FileZilla,
and on Wins 7:
>mysql -u root -proot wordpress < db_name_dump-oct-14.sql
Remember, do not give semi-colon at last.
Those characters are an encoded parser report. When decoded with scripts/decode_bug.php, it reports:
ERROR: C1 C2 LEN: 1 2 11
STR:
MySQL: 5.5.32
USR OS, AGENT, VER: Win CHROME 5.0.30
PMA: 4.0.4.1
PHP VER,OS: 5.4.19 WINNT
LANG: en
SQL:
So, it cannot report which SQL statement gave a problem. Maybe your import operation was incomplete, due to some incorrect server settings. See FAQ 1.16 in phpMyAdmin documentation include in your kit, or http://www.phpmyadmin.net/home_page/docs.php.
Check the last line of your .sql file in an editor(Sublime Text or whatever you prefer). Does it have strange characters there? ETXNULLNULLNULLNULL etc. Remove that line and retry your import. Worked for me.
Just want to tack on a note that using TextWrangler I could not see the extra characters or text at the end of the sql document; however, I did see a white space, so I selected and deleted it, then saved. When I then imported into the database, the error disappeared! So take heart, Mac users, or rather TextWrangler users, who might have been mystified by the missing characters.

Import database backup return #1064

Suddenly importing database backup returns the error below.
The odd thing is that importing an old working copy it works.
If I export it straight afterwards and I try to re-import it the file gives this error.
Looks like it's PhpMyAdmin export that causes issue.
Is there any change in PhpMyAdmin export process that I'm not aware of?
This looks like my problem but the solution didn't work for me.
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:
----INIZIO CUT----
eNo1jU0KwjAYRIXuvlPMAWIw0SrNLoTQLvJn0roXF1IQ3Sjo7U0FZ/UYHjM255gVjICRcDYoCEgI
QWWsdUPkP+XoFFou+L5b3x5XmkpGLAy6t2FkONkq+vMFZsjR22puuOwoea2wq9xSGtJisViWnS0X
B7j5/nqT06FXmJ/0u6Bm9c8XSs4hPQ==
----FINE CUT----
----INIZIO RAW----
ERROR: C1 C2 LEN: 1 2 11
STR: MySQL: 5.1.69-log
USR OS, AGENT, VER: Mac CHROME 5.0.29
PMA: 4.0.5
PHP VER,OS: 5.3.17 Linux
LANG: it
SQL:
----FINE RAW----
Query SQL:
Messaggio di MySQL:
#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
(I translated what I could in the error as my phpmyadmin is in Italian)
I had the same problem and I found the solution. Open the sql document with any code editor and at the very end in the last line you will see some black strange codes just delete and save should work as it worked for me.
I'm not sure how and why this code been generated when I exported my database.
You are running an outdated phpMyAdmin version. I believe that the fix mentionned in https://sourceforge.net/p/phpmyadmin/bugs/4095/ (for the upcoming 4.0.8 version) will help you.
Direct link to the fix (can be applied to 4.0.7): https://github.com/phpmyadmin/phpmyadmin/commit/b717657de77db0b58179bdbdd88e23d0fc3d7ea6