#54 schema backup

options/variables
closed
nobody
None
5
2012-01-20
2012-01-20
Anonymous
No

Is it possible to add something like this:
CONFIG_mysql_schemas_dump_use_separate_dirs='yes' #store schemas per folders, the best way to restore

Thanks

Discussion

  • PittaGurneyi
    PittaGurneyi
    2012-01-20

    • status: open --> closed
     
  • PittaGurneyi
    PittaGurneyi
    2012-01-20

    Compared to a normal dump fullschema files have much less content. Therefore, I don't see the need to split them. However, it is really easy to extract parts of those files. Let me make an example:
    awk '/CREATE DATABASE.*`(mysql|mailsqldb)`/ {p=p?p:!p; print; next}; p==1 {if($0 ~ /CREATE DATABASE/) {p=!p;next} else print}' YOUR_SQL_FILE.sql

    gives you the lines for your database mysql and mailsqldb.
    (option1|option2) matches one of the options, where (|) are special characters, meaning, that if you don't need multiple options, you can just use `mysql` for example without any (|). For further options, etc. take a look at the GNU Awk handbook http://www.gnu.org/software/gawk/manual/gawk.html or the handbook of your awk implementation.

     
  • PittaGurneyi
    PittaGurneyi
    2012-01-20

    I'm leaving comment posting open if people want to contribute other ways of extracting data. I however won't provide support for this.