User:Kelson/Memo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
# Get table list with prefix | # Get table list with prefix | ||
mysql -N information_schema -ufoouser -pfoopass -e "SELECT table_name FROM tables where table_schema='foodb' AND table_name like 'prefix_%'" > tables.txt | mysql -N information_schema -ufoouser -pfoopass -e "SELECT table_name FROM tables where table_schema='foodb' AND table_name like 'prefix_%'" > tables.txt | ||
# Dump only a subselection of table in a DB | |||
mysqldump -ufoouser -pfoopass dbname `cat tables.txt` | xz > dbname.sql.xz | |||
# Dump DB without triggers | # Dump DB without triggers | ||
mysqldump --skip-triggers -ufoouser -pfoopass foobar | xz > foobar.notriggers.sql.xz | mysqldump --skip-triggers -ufoouser -pfoopass foobar | xz > foobar.notriggers.sql.xz | ||
</source> | </source> | ||
Revision as of 18:22, 13 March 2013
MySQL
# Get table list with prefix
mysql -N information_schema -ufoouser -pfoopass -e "SELECT table_name FROM tables where table_schema='foodb' AND table_name like 'prefix_%'" > tables.txt
# Dump only a subselection of table in a DB
mysqldump -ufoouser -pfoopass dbname `cat tables.txt` | xz > dbname.sql.xz
# Dump DB without triggers
mysqldump --skip-triggers -ufoouser -pfoopass foobar | xz > foobar.notriggers.sql.xz