8109175771

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

PHP 17-05-2021

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

Details

If you have a .sql file and you want to import it into a different server using the command line. then you have to check it's full path of file if my file location is "F:\test.sql" after that start command prompt and go to bin location of mysql with the use of bellow command

cd C:\xampp\mysql\bin
after that you have to use bellow command to import database
mysql -u username -p database_name < F:\test.sql
where username is username of server phpmyadmin, database_name is name of database then press enter button and write password of server phpmyadmin then press enter button


Example

Close Ads