Dumping and Importing database

Best practice states that the /home/user/.my.cnf or /root/.my.cnf file should be created (depending on what user you are taking the dump with) with the appropriate credentials before taking a mysql dump. This is not mandatory but certainly makes life easier when working with mysql
Creating the file is as easy as:

1
vim /root/.my.cnf
1
2
3
[client]
user: root
password: mypassword

Viewing databases outside of mysql

You can view your mysql databases without logging into mysql with the following command:

1
mysql -e "show databases"
or
1
mysqlshow