Saturday, January 19, 2013

Install a .sql file to a database in MySQL

First open the command prompt and go to the your MySQL installed directory and go to the bin folder in command prompt.Then copy your database file(.sql file) to that directory(C:\Program Files\MySQL\MySQL Server 5.5\bin).
Then in command prompt run this code.

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql --user=USER_NAME --password=PASSWORD DATABASE_NAME<FILE_NAME.sql


As a example let's think my MySQL user name is root and password is dilan and I want to install a file called queries.sql to the database named myTestDB. The code snippet  will be as following.

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql --user=root --password=dilan myTestDB<queries.sql

No comments:

Post a Comment