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;
Related
I'm pretty confused - I'm not too used to using command prompt for anything but I've recently been forced to do it as I'm trying to host my database with Digital Ocean.
I'm currently attempting to transfer my local database onto their servers by using the MySQL 8.0 Command Line Client.
The guide on their website says to use this command:
mysql -u doadmin -p -h mysql-test-do-user-4915853-0.db.ondigitalocean.com -P 25060 your_database_name \
< /path/to/database_file_name.sql
where the first part is the connection string that you get from their website and the second part is the file path on my PC.
I pass the connection string and it gives no errors, indicating to me that it's connecting to my database, but when I try to pass it a file path I get the following errors:
ERROR:
Unknown command '\U'
ERROR:
Unknown command '\J'
ERROR:
Unknown command '\D'
It seems like it's getting these strings from the file path, as if it's not recognising it as a file path but instead throwing errors.
I've tried putting just the file name on its own - nothing happens.
I don't even know the commands to check whether or not the tables have been added to my database.
The guide is not specific as to what the file path should look like.
Can anyone offer guidance? All I want to do is transfer my 6 tables into my new database (and rename the database, preferably).
Thanks,
Jordan
I'm trying to add the employee sample database for practicing with MySQL however there's an error since there's a source command and from what I've found it says that MySQL doesn't support this command anymore.
So, how could I add the complete database without any error?
[this is the code line where the source command is called]
SOURCE is one of the mysql client builtin commands. These are recognized by the mysql client, but not by the MySQL Server's SQL parser.
See https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html
I have a perfectly working database and currently want to copy that to another server machine running CentOS7 VM. In the original server, I used phpMyAdmin to export .sql file for the database with "Quick setting" as shown below:
Then I uploaded the .sql file to the VM through FTP. Everything was still good until I ran the cmd mysql -u root new_db < some.sql. The error said:
ERROR 1064 (42000) at line 2553295: 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 '<br />
<b>Fatal error</b>: Maximum execution time of 300 seconds exceeded in <b' at line 16
I'm 100% sure that the db worked without issues in the original server, and I haven't touched any source code in the .sql file. What may the near <br /> warning suggest? Thanks a lot for any suggestions and help.
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" /> 
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.
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.