i am trying to import sql file through putty
below are my details of DB
dbname - test,
password - test123,
username -utest,
i tried the below code
mysql -u utest -p test123 test< /home/path/public_html/file.sql
when i run this command i saw a 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 'mysql -u utest -p test123 test < file' at line 1
please suggest how to import sql file
Thank Sanjib
try this
mysql -utest -ptest123 test < /home/path/public_html/file.sql
and make sure that you run this command from your console not in mysql
if you are in mysql prompt than it would be somehting like this
mysql> use test;
mysql> source /home/path/public_html/file.sql;
OR
mysql>SET autocommit=0; source /home/path/public_html/file.sql; COMMIT;
You should run this command in your console, outside of the mysql tool.
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 am getting the following error while trying to import the table into database using MySQL on my Ubuntu machine.
Error:
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 spesh db_hit_type < /var/www/html/spesh.com/public_html/portal/' at line 1
I was using the following command to import the table data.
mysql -u root -p spesh db_hit_type < /var/www/html/spesh.com/public_html/portal/js/db_hit_type.sql;
I think that you try to run this command in MySQL command promt or in some client program. You need to run mysql program from server console, not from mysql console.
In the Command Line I created a database with:
create database mysql;
but when i try to upload a database file with the command:
mysql -u root -p database < dbdump.sql;
i receive a syntax error and i don't understand where i'm wrong
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 database < dbdump.sql' at line 1
confirm you're running the command from a shell and not from mysql.
I recall needing to be in mysql.exe directory when running such commands
remove the spaces around <. Ie, write mysql -u root -p database<dbdump.sql
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;
I am unable to create mysql database dump. I have tried all the commands in the below question
https://stackoverflow.com/questions/24858436/unable-to-create-mysql-dump-in-mysql-server-5-6-19
But every time I get similar error which asks me to check manual
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
dump -u root -pmysqlmysql hospital_management -r "c:\hosp.sql"' at line 1
I am trying these commands in Mysql command line and NOT on Windows command prompt. Also I am trying these commands before entering any database in mysql.
mysql> mysqldump -u root -pmysqlmysql hospital_management > hosp.sql
This was the first command I tried, which did not work
mysqldump is an executable, you should not run it in the MySQL command line.
Try the command
mysqldump -uroot -pmysqlmysql hospital_management > "C:\hosp.sql"
By reading the documentation, I assume that when using -r, the file must already exist.