Ottimizzare tutte le tabelle in un database MySQL

From RVM Wiki
Revision as of 14:47, 11 June 2024 by Gabriele.vivinetto (talk | contribs) (Created page with "* Usare lo script <pre> #!/bin/bash for table in $(mysql -u root -proot_pwd -sss -e "select concat(table_schema,'.',table_name) from information_schema.tables where table_schema in ('mydatabasename') order by data_free desc;") do echo OPTIMIZE $table mysql -u root -proot_pwd -e "OPTIMIZE TABLE $table;" done </pre>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • Usare lo script
#!/bin/bash
for table in $(mysql -u root -proot_pwd -sss -e "select concat(table_schema,'.',table_name) from information_schema.tables where table_schema in ('mydatabasename') order by data_free desc;")
do
  echo OPTIMIZE $table
  mysql -u root -proot_pwd -e "OPTIMIZE TABLE $table;"
done