views:

142

answers:

1

I have about 100 databases (all the same structure, just on different servers) with approx a dozen tables each. Most tables are small (lets say 100MB or less). There are occasional edge-cases where a table may be large (lets say 4GB+).

I need to run a series of ALTER TABLE commands on just about every table in each database. Mainly adding some rows to the structure, but a few changes like change a row from a varchar to tinytext (or vice versa). Also adding a few new indexes (but indexing new rows, not existing ones, so assuming that isn't a big deal).

I am wondering how safe this is to do, and if there are any best practices to this process.

First, is there any chance I may corrupt or delete data in the tables. I suspect no, but need to be certain.

Second, I presume for the larger tables (4GB+), this may be a several-minutes to several-hours process?

Anything and everything I should know about performing ALTER TABLE commands on a production database I am interested in learning.

If its of any value knowing, I am planning on issuing commands via PHPMYADMIN for the most part.

Thanks -

+3  A: 

First off before applying any changers, make backups. Two ways you can do it: mysqldump everything or you can copy your mysql data folder.

Secondly, you may want to use mysql from the command line. PHPMyAdmin will probably time out. Most PHP server has timeout less than 10 minutes. Or you accidently close the browser.

Yada
backing up ~100 databases with table sizes between 100MB and 4GB+ must be worth another question :-)
Maxwell Troy Milton King
+1 for command line suggestion.
Maxwell Troy Milton King
any possible issues regarding to locked rows?
Jorre