How to import a .sql file

I am running MySQL on Ubuntu 10.4 LTS and, unfortunately, I am having serious problems importing the sql file.

What am I actually doing:

1) I go to the directory containing the sql file that is being called: bk.sql

2) Then I type:

mysql -u root -p (and then I enter the root password and everything goes smoothly)

3) I use this command to perform the import operation (provided that the password = 123 m. Database name = Mydb sql file = bk.sql)

 mysql -u root -p 123m Mydb < bk.sql; 

I get:

 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 123m Mydb < bk.sql' at line 1 

Is the import procedure performed correctly?

+4
source share
3 answers

It looks like you are using the mysql import command from the mysql prompt, which is not correct.

You do not need to do step 2. Just follow steps 1 and 3.

+7
source

Do it and you will get it.

 mysql -u root -ptoor -h localhost database_in_mysql < local_sql_file.sql mysql> show databases; mysql> use meow; mysql> select * from customers_meow; 

and you will see all the bingo tables! ch33rs.

+4
source

First enter this .. in cmd or terminal ...

 mysql -u root -p Mydb < bk.sql 

Then it asks for a password

 Password : 123m 

Now wait .. I'll borrow a few times. that's all...

0
source

All Articles