databasemysqlmysql-error-1049

Mysql import database


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?


Solution

  • 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