Suppose that I want to access mysql server and print all tables and databases and their data in localhost using bash script.
The script I have looks like:
mysql -u root -p password
After the script is executed, the mysql shell opens instead of bash. So how can I run a command with mysql?
Also, what command should I execute to print out all databases, tables and their data?
Edit: I now get which command I should use, but still the question remains:
I need to make it into the script, but when entering mysqldump command, it asks for password interactively.
So how can I handle password in a bash script?