Reputation: 57
I am new to mysql.I got a .sql file which I needed to import,so I searched online and got the below command.It worked perfectly.
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p test3 < test3.sql
But when I said use test3 from mysql command line client,it gave me this error :
ERROR 1049 (42000): Unknown database 'test3'
Am I missing some step?
Upvotes: 0
Views: 5926
Reputation: 1234
First of all you would need to create the database in MYSQL so that once you use the command, it is able to locate the name of the database
You can create the table using MYSQL developer tool or using the command line and then you can execute
mysql -u root -p test3 < test3.sql
Upvotes: 1
Reputation: 769
You have not created test3 database yet. First create a test3 database & then try to import.
Upvotes: 0
Reputation: 297
The database needs to exist, and be called from the command line using -D
so within MySQL try;
mysql> create database test3;
and back at the command prompt, try;
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p -D test3 < test3.sql
Upvotes: 4