Upgrading MySQL 5.0 to 5.5 with mysqldump
With MySQL 5.5 becoming GA last week, there will probably be a few requests to upgrade to 5.5 straight from 5.0.
MySQL's binary upgrade strategy involves turning off the server, upgrading the software, turning the server back on and running the mysql_upgrade script (which will modify the privilege tables, and run table checks on your data). And this is only supposed to work between versions: the MySQL 5.5 mysql_upgrade script assumes it's looking at a mysql database from 5.1, not 5.0.
A binary upgrade from MySQL 5.0 to 5.5, then, involves an intermediate step of upgrading to 5.1 (and running its mysql_upgrade script) before installing 5.5 and running its mysql_upgrade.
If, however, you want to avoid this step and can backup your data using mysqldump, here's what you can do:
MySQL's binary upgrade strategy involves turning off the server, upgrading the software, turning the server back on and running the mysql_upgrade script (which will modify the privilege tables, and run table checks on your data). And this is only supposed to work between versions: the MySQL 5.5 mysql_upgrade script assumes it's looking at a mysql database from 5.1, not 5.0.
A binary upgrade from MySQL 5.0 to 5.5, then, involves an intermediate step of upgrading to 5.1 (and running its mysql_upgrade script) before installing 5.5 and running its mysql_upgrade.
If, however, you want to avoid this step and can backup your data using mysqldump, here's what you can do:
- Take a backup but without the mysql database.
shell> mysqldump [other options] --databases db1 db2 db3 > main_backup.sql
- Take a backup of the mysql database, but without the table definitions and with the inserts specifying the columns:
shell> mysqldump [other options] --complete-insert --no-create-info mysql > mysql_backup.sql
- Shut down current mysql installation, move datadir contents (so datadir is empty for a fresh install of 5.5).
- Install and start up MySQL 5.5 installation. By default you should be able to login as user root with no password.
- Import mysql_backup.sql into MySQL.
- Run these in the client to remove the default users and set the old users and passwords from the previous installation:
mysql> DELETE FROM mysql.user WHERE user = '';
mysql> DELETE FROM mysql.user WHERE user = 'root' AND password = '';
mysql> FLUSH PRIVILEGES;
(You might want to check for other unauthorized users at this stage too). You can now log off and log back in as your original root or admin user.
- Import main_backup.sql into MySQL.
- Run the mysql_upgrade script (for proof you did everything right).
Labels: mysql
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home