altre destinazioni
vedi anche
- Yes, I am a data geek / 3 «
- Yes, I am a data geek / 1 «
- Chi ha bisogno di SOAP? Abbiamo MySQL «
- Merge Postscript files «
ultimi post
- Come si incentiva il trasporto pubblico in Lombardia / 1 «
- Dieci e uno «
- Maratoneti «
- Jiayu G3, dove comprarlo (e ne vale la pena)? «
- Come risparmiare batteria su Android «
ultimi commenti
- ludo, Dieci e uno «
- theo, Dieci e uno «
- ludo, Libevent-based HTTP/1.1 client «
- george d, Libevent-based HTTP/1.1 client «
- ludo, Libevent-based HTTP/1.1 client «
tag principali
- blogging
- italia
- milano
- spigolature
- conferenze
- top100
- python
- web 2.0
- blogbabel
- rugby
- calcio
- ebook
- tv
- barcamp
- musica
- nanopublishing
- lightpress
- django
- php
categorie
- blogging «
- books «
- calcio «
- design «
- digital underground «
- ebay «
- eventi «
- gadget «
- games «
- general «
- guest blogger «
- help «
- in evidenza «
- internet business «
- lazyweb «
- letture «
- linux «
- luambo «
-
ludo «
- audio e musica «
- foto «
- quotidianità «
- rete «
- luoghi «
- milano «
- misc «
- miscellanea «
- mobile «
- mobile e pda «
- motori di ricerca «
- music «
- musica «
- news «
- personal «
- php «
- podcasting «
- podcasts «
- prima pagina «
- python «
- rugby «
- screencasts «
- simpleaggregator «
- sistemi operativi «
- smanettando «
- software «
- staticblog «
- sviluppo «
-
tech «
- ipaq «
- palm «
- programmazione «
- tecnologie varie «
- web «
- technology «
- tecnologia «
- tex «
- tv «
- varie «
- web 2.0 «
- web design «
archivi
- luglio 2013 «
- aprile 2013 «
- marzo 2013 «
- febbraio 2013 «
- novembre 2012 «
- ottobre 2012 «
- aprile 2012 «
- settembre 2011 «
- agosto 2011 «
- luglio 2011 «
- giugno 2011 «
- maggio 2011 «
- marzo 2011 «
- febbraio 2011 «
- gennaio 2011 «
- dicembre 2010 «
- novembre 2010 «
- ottobre 2010 «
- settembre 2010 «
- giugno 2010 «
- maggio 2010 «
- novembre 2009 «
- settembre 2009 «
- agosto 2009 «
- luglio 2009 «
- giugno 2009 «
- maggio 2009 «
- aprile 2009 «
- marzo 2009 «
- febbraio 2009 «
- gennaio 2009 «
- novembre 2008 «
- ottobre 2008 «
- settembre 2008 «
- agosto 2008 «
- luglio 2008 «
- giugno 2008 «
- maggio 2008 «
- aprile 2008 «
- marzo 2008 «
- febbraio 2008 «
- gennaio 2008 «
- dicembre 2007 «
- novembre 2007 «
- ottobre 2007 «
- settembre 2007 «
- agosto 2007 «
- luglio 2007 «
- giugno 2007 «
- maggio 2007 «
- aprile 2007 «
- marzo 2007 «
- febbraio 2007 «
- gennaio 2007 «
- dicembre 2006 «
- novembre 2006 «
- ottobre 2006 «
- settembre 2006 «
- agosto 2006 «
- luglio 2006 «
- giugno 2006 «
- maggio 2006 «
- aprile 2006 «
- marzo 2006 «
- febbraio 2006 «
- dicembre 2005 «
- novembre 2005 «
- ottobre 2005 «
- settembre 2005 «
- agosto 2005 «
- luglio 2005 «
- giugno 2005 «
- maggio 2005 «
- aprile 2005 «
- marzo 2005 «
- febbraio 2005 «
- gennaio 2005 «
- dicembre 2004 «
- novembre 2004 «
- ottobre 2004 «
- settembre 2004 «
- agosto 2004 «
- luglio 2004 «
- giugno 2004 «
- maggio 2004 «
- gennaio 2004 «
- dicembre 2003 «
- novembre 2003 «
- ottobre 2003 «
- settembre 2003 «
- agosto 2003 «
- giugno 2003 «
powered by
- WPFrontman + WP
friends
copyright
- © 2004-2011
Ludovico Magnocavallo
tutti i diritti riservati
Convert a bunch of tables to InnoDB
A friend just asked me how to convert a bunch of MySQL tables from InnoDB to InnoDB, and since it seems that Google yields no practical answers to this question, I am posting the following few lines as a reference for other people. Nothing new, but useful if you are not familiar with either MySQL or bash.
The SQL statement to convert a single table to a different table type in the MySQL client is:
alter table mytable type=InnoDB;
More often than not you will need to convert all the tables in a single DB, so if you are using bash you can save a few boring keystrokes and the inevitable typing errors using something like this:
for t in $(mysql --batch --column-names=false -e "show tables" mydbname); do mysql -e "alter table $t type=InnoDB" mydbname; done
If you need to omit a few tables, or convert only tables starting with a common prefix, you can use grep in the for statement:
for t in $(mysql --batch --column-names=false -e "show tables" mydbname |grep -v "exclude_this"); do mysql -e "alter table $t type=InnoDB" mydbname; done
for t in $(mysql --batch --column-names=false -e "show tables" mydbname |grep "include_this"); do mysql -e "alter table $t type=InnoDB" mydbname; done
Or directly type the names of the tables you need:
for t in table_1 table_2 table_n; do mysql -e "alter table $t type=InnoDB" mydbname; done
13 maggio 2005 #
Inspiring.
I am going to write a PHP script that will do this for me and may be post the same to my blog.
thanx
23 maggio 2005 #
Great bit of info, especially for guys like me who don’t really want to learn Bash just to change my MySQL table types.
One note, on my mysql binary (v. 3.23.58) there doesn’t appear to be a “–column-names” switch, and the script above will not work. Running without that switch will get the job done, but the script will give a single error when it tries to convert a “Tables_in_dbname” table to innodb.
23 maggio 2005 #
Leonard, thanks for pointing out the missing switch in MySQL 3.x.
As you have noticed the warning message does no harm, but if you want to exclude it just use “| grep -v Tables_in” after the mysql invocation, as shown in one of the examples above.