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

Syntax:

 mysql -u database_username -p YourDatabaseName < database_name.sql  

Example:

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

Syntax:

mysqldump -u database_username -p YourDatabaseName > database_name.sql

Example:

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;