24 lines
711 B
Markdown
24 lines
711 B
Markdown
# MySQL Tricks
|
|
|
|
## dump all MySQL databases at once
|
|
|
|
```bash
|
|
for i in $(mysqlshow -uroot -p | awk '{print $2}' | grep -v Databases); do mysqldump -uroot -p $i > $i.sql; done
|
|
```
|
|
|
|
## mysqldump without the artwork
|
|
|
|
Often you want to get results from the mysql client without all the ASCII box table formatting and column names.
|
|
|
|
The `-B` or `--batch` option will force the output to be TAB delimited no matter where the output is going.
|
|
|
|
The `-N` option will turn off column names in the output.
|
|
|
|
The following outputs the result of the query in TAB delimited format without column names:
|
|
|
|
```bash
|
|
mysql -B -N -e "select distinct table_schema from information_schema.tables"
|
|
```
|
|
|
|
Tags:
|
|
howto |