Date Archives

September 2020

Basic mysql commands

How to create new database & list the databases.

mysql -u root -p

Enter password: **********

mysql> CREATE DATABASE blAblA;
mysql> SHOW DATABASES;
mysql> use blAblA;
mysql> SHOW TABLES FROM blAblA;

How to backup & restore the mysql database at the same. We can use mysqldump command.

mysqldump db_name | mysql new_db_name
mysqldump -u <user name> --password=<pwd> <original db> | mysql -u <user name> -p <new db>

You can use -h command to define the host.