added new notes
This commit is contained in:
24
blog - fun with mysql.md
Normal file
24
blog - fun with mysql.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user