Can I get the basic MySQL command in BASH?

Can I get the basic MySQL command in BASH? show, describe for starters. I am trying to fix a problem with multiple databases, and I want to compare them with more specifics. Landfill is too much information.

+4
source share
2 answers
echo "command" | mysql -u username -ppassword -h host database_name 

not only the basic command can be executed, but also full SQL

+4
source

I don't know if you can, but there are too useful options in mysqldump that can help you.

The first option is to reset the structure only without any data by adding the -d option

 mysqldump -d -h host -u username -p databasename > dumpfile.sql 

Another great option is where, and here is the description from the manual:

  --where="where-condition", -w "where-condition" Dump only records selected by the given WHERE condition. Note that quotes around the condition are mandatory if it contains spaces or characters that are special to your command interpreter. Examples: "--where=user='jimf'" "-wuserid>1" "-wuserid<1" 

For more information, check it out on the mysqldump man page: http://linuxcommand.org/man_pages/mysqldump1.html

+1
source

Source: https://habr.com/ru/post/1403291/


All Articles