InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Mysql tutorials

  • Enable query log without restarting mysql on Linux
  • How to find mysql query rate on Linux
  • Mysql - display row count and size of tables
  • Mysql - get size of all databases
  • Mysql - get total queries since beginning
  • Mysql - how to copy a table
  • Mysql - how to enable query log
  • Mysql 5.7 root password after installation
  • Mysql difference between CURDATE() and NOW()
  • Mysql find current timezone offset
  • Mysql find slave lag
  • Mysql how to dump schema of all databases
  • Wordpress Mysql Queries
  • mysql - how to enable query logs
  • mysql find recently created-tables
 
  • Home
  • > Tutorials
  • > Mysql

Mysql how to dump schema of all databases

By admin on Jan 24, 2016

It is a good idea to frequently take schema dump of all your databases. This may be useful in case there is some accidental change. This is also useful for viewing schema history.

Mysql schema dump using mysqldump

$ mysqldump -u username -ppassword --no-data --all-databases

Daily schema dump

To take daily schema dump in a shell script use the following bash code in cron

DATE=$(date +"%Y%m%d")
mysqldump -u username -ppassword --no-data --all-databases > mysql.schema.$DATE

Or you can use the following one liner in cron

mysqldump -u username -ppassword --no-data --all-databases > mysql.schema.`date +"%Y%m%d"`

Schema dump over ssh

In case you want to run it over ssh so that you can take mysqldump on you local Mac or Linux machine, you can use the following command:

$ ssh -i id_rsa -l user machine.com "mysqldump -u username -ppassword -h localhost --no-data --all-databases"

Suggested posts:

  1. migrate multiple mysql databases using mysqldump on Linux
  2. Memcache – how to dump all keys and values on command line
  3. Mysql – get size of all databases
  4. Javascript – dump all handlers on window object
  5. How to connect to mysql server using ssh port forwarding
  6. How to find mysql query rate on Linux
  7. Mysql difference between CURDATE() and NOW()
  8. How to check the performance of a plugin using mysql query log
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Mysql, Tutorials

Follow InfoHeap

facebook
twitter
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2021 InfoHeap.

Powered by WordPress