Import MySQL Database Using Command Line – SOLVED
17 June 2010
No Comment
Posts and pages
Follow the below code to import mysql database using command line.
mysql -uUSERNAME -pDATABASE < DATABASE_FILE.SQL
Format: mysql -uroot -ppasword -hlocalhost database-name < sql_dump_file_name.sql
Correct Example: mysql -uroot -palakmalak -hlocalhost oca < cerb4oca.sql
Note: Do not go to mysql console. Just go to the directory where your backup file resides.
Note: Do not use -u space username like -u root ( this will not work ) use -uroot -ppassword -hlocalhost
Wrong Example: mysql -u root -p abc123 localhost < mytest.sql
where root is USERNAME of MySQL, abc123 is DATABASE of MyQL and mytest.sql is a file you want to import in to selected database.









Leave your response!