How to import .sql file in mySQL database?

MySQLThere are 2 ways to import  .sql database file in mySQL.

1) Import the .sql file from phpMyAdmin

Select the database in which you wish to import MySQL file.

Import -> Browse for the .sql file and click on GO.

If you are lucky your database will be imported if not look for next 2 methods

2) Run the sql query from command prompt

If you have access to your webhost either direct or via SSH

The sql query to import .sql database is

mysql -h host -u databaseusername-p databasename< database.sql


host with your actual host (in most cases it would be localhost)

databaseusername with the user name assigned to access above database

databasename with your actual database name

database.sql with your actual .sql file


Leave a Reply

Your email address will not be published. Required fields are marked *