I want to import a sql.gz file into mySQL database, and I follow the instruction on Google. But it just failed. I really can't figure out why. So I came here to ask for help.
Here are my query commands:
zcat qmdb__v1_3__102019.sql.gz | mysql -u root -p 123456 meterial;
gunzip < F:/qmdb__v1_3__102019.sql.gz | mysql -u root -p meterial;
gunzip < qmdb__v1_3__102019.sql.gz | mysql -u root -p meterial
Three types all failed.
The error message:
ERROR 1064 (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 'gunzip < qmdb__v1_3__102019.sql.gz | mysql -u root -p meterial' at line 1
enter image description here
I think my file path isn't wrong.
Related
I am trying to import mysql data dump to Maria DB with below command
mysql -u root -p --one-database new_db < data_dump.sql;
But I am getting below error
ERROR 1064 (42000): 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 'mysql -u root -p --one-database zapcheck <
zapcheck.sql' at line 1
I tried different combinations but nothing worked. Its not even telling what's the issue.
Please let me know the issue here or is there any other way I can import?
You can try the command below to import the file:
Note: Open the terminal where dump.sql is located
After opening the terminal:
//Skip this process if you have already created a database.
Mysql> create database newdb;
// Using the new created database
Mysql> use newdb;
// Importing the dump.sql file to newdb database
Mysql> source dump.sql
I'm unable to export my database.
I have tried several times unsuccessfully including:
mysqldump -u root -p --opt --db_2 -r backup.sql;
and
mysqldump --database --user=root --password db_2 > export_into_db.sql;
I get this error with both of them:
ERROR 1064 (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 'mysqldump --database --user=root --password db_2 >
export_into_db.sql' at line 1
For anyone who is using mac you need to do the following steps in order to export the sql:
1.open a new terminal window
2.type this to enter the mysql if your unable to enter it PATH=$PATH:/usr/local/mysql/bin
3.mysqldump -u root -p db_2 >/Users/your_name/Desktop/sql.sql;
4.type password
I try to clone my_db to my_db_clone. I followd this post and this but I get always
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax
I tried thise but none worked, I get always that error :
mysqldump -u my_user -p my_db | mysql -u backup -pmy_password my_db_clone
mysqldump my_db | mysql my_db_clone;
mysqldump my_db -u my_user -pMy_passwprd > dumpdb.sql;
The mysqldump utility runs in the shell. How are you invoking it? Based on your error message, it appears that you might be trying to run it in the mysql client.
Try it in the shell instead.
I'm almost through and I got stuck at the General Server Configuration from step 6. As in when I try the 7th step, I receive below error;
mysql> mysql -u admin -p -D EMM_DB <
/usr/local/bin/wso2emm/dbscripts/emm_mysql.sql; ERROR 1064 (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 'mysql -u admin -p -D EMM_DB <
/usr/local/bin/wso2emm/dbscripts/emm_mysql.sql' at line 1
I assume that the command I'm issuing is incorrect and if someone could clear out the issue.
Database name field, should be joined with the -D and also I would suggest to use UTF8 parameter
mysql> mysql -u admin -p -DEMM_DB --default_character_set=utf8 < /usr/local/bin/wso2emm/dbscripts/emm_mysql.sql;
This is the command I used:
mysql> mysql -u root -p -h HOST sample < mysqldump.sql;
But I encountered an error as follows:
ERROR 1064 (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 'mysql -u root -p -h HOST sample < mysqldump.sql' at line 1
Hope you can help me out?
That's the command you should give in the command line, not in MySQL itself.
Open mysql terminal or konsole and then go to the directory where mysqldump.sql file is present. try:
shell> cd /file_path/;
shell> ls -al mysqldump.sql;
It should display your file. Also you dont need to specify HOST if you are logged on to the same server.
shell> mysql -u root -p sample < mysqldump.sql;
from client you can run \. mysqldump.sql but i think first variant is preferable.