Categories :

How to import an SQL file using the command line in MySQL?

#Step1: Create just databse in your phpMyAdmin
 Ex: test_table.sql

#Step2: put sql databse file in bin folder
 Ex: E:wamp64binmysqlmysql5.7.26binDBtest_table.sql

# Open CMD
# Step3: Change the directory folder current directory to mysql bin directory.
 C:Userskishanvk>CD E:wamp64binmysqlmysql5.7.26bin ↲
 C:Userskishanvk>E: ↲

# Step4: write below command line and in this cmd
 E:wamp64binmysqlmysql5.7.26bin>mysql -u [Username] -p [DBNAME] < DB[DBNAME.sql] ↲

 Ex: E:wamp64binmysqlmysql5.7.26bin>mysql -u root -p test_table < DBtest_table.sql ↲

# Step5: Enter password
 Enter password:***** ↲

# Step6: You can see imported database in your phpMyAdmin

Leave a Reply

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