How To Import MySQL Database Using Command Prompt

In this article, We learn about how to import MySQL Database using Command Prompt.

Here is a step:

  1. Open Command Prompt.

2. go to the MySQL folder.

    • If you use wamp then add this line on CMD “cd C:\wamp64\bin\mysql\mysql5.7.24\bin“.
    • If you use xampp then add this line on CMD “cd C:\myxamp\mysql\bin“.

3. Create a Database on phpMyadmin.

4. Connect your database using this command “mysql.exe -use databasename -u username -p”

  • databasename: Add Database name
  • username: Add database’s username

5. press Enter and add password again.

6. To make things easier, copy the SQL file into the same folder as mysql.exe, and then run this “source thecodehubs.sql” and press Enter.

Here is a result

This process is very helpful and faster than manually import.

Submit a Comment

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

Subscribe

Select Categories