Import, export and drop database using command line

Import Database using command line:
To import database in your mysql host mysql account using command line (cli). Follow this syntax


 mysql -u database_username -p YourDatabaseName < database_name.sql  


mysql -u root -p coddu_db < coddu_db_july_2020.sql

Export Database using command line:
To export database from your mysql host account to sql (.sql) file. Follow this syntax


mysqldump -u database_username -p YourDatabaseName > database_name.sql


mysqldump -u root -p coddu_db > coddu_db_july_2020.sql

Drop or Delete Database using command line:
To drop database using command line, follow these steps

Step 01:
Login to mysql using command line

mysql -u database_username -p

Step 02:
List databases command line

show databases;

Step 03:
Drop database

DROP DATABASE database_name;