Here comes the time to upgrade from MySQL 3.23 to the latest MySQL 5.0. In the first part, I will guide you through the MySQL 3 to MySQL 4 upgrade.
MySQL recommends we upgrade to next series available.As a general rule, we recommend that when upgrading from one release series to another, you should go to the next series rather than skipping a series. For example, if you currently are running MySQL 3.23 and wish to upgrade to a newer series, upgrade to MySQL 4.0 rather than to 4.1 or 5.0.
- Read upgrading section for the release series to which you are upgrading, change notes to learn about new features.
- Backup your databases.
- Making changes to the grant tables. Read “Upgrading the Grant Tables”.
- Read MySQL replication upgrade info
- MySQL-Max distribution: According to MySQL, you will need to " upgrade later to a non-Max version of MySQL, mysqld_safe still attempts to run the old mysqld-max server. If you perform such an upgrade, you should manually remove the old mysqld-max server to ensure that mysqld_safe runs the new mysqld server."
For this MySQL says that you can move MySQL format and data files "between different versions on the same architecture as long as you stay within versions for the same release series of MySQL". If character set of a table needs to be changed, then run
charsetmyisamchk -r -q --set-character-set=on all MyISAM tables. The character sets need to be changed because other indexes that you created on MySQL may not work because the sort order can be changed if the character set is changed.
Renaming old MySQL
At this point you may want to rename MySQL directory for backup. mysqldump can be used to do this job. Then mysql or mysqlimport can be invoked to read the database dumps created by MySQL.
MySQL says
If, after an upgrade, you experience problems with recompiled client programs, such as Commands out of sync or unexpected core dumps, you probably have used old header or library files when compiling your programs.Convert old ISAM tables to MyISAM format
....
If problems occur, such as that the new mysqld server does not want to start or that you cannot connect without a password, verify that you do not have some oldmy.cnffile from your previous installation. You can check this with the--print-defaultsoption (for example, mysqld --print-defaults). If this displays anything other than the program name, you have an activemy.cnffile that affects server or client operation.It is a good idea to rebuild and reinstall the Perl
DBD::mysqlmodule whenever you install a new release of MySQL. The same applies to other MySQL interfaces as well, such as the PHP mysql and mysqli extensions or the Python MySQLdb module.
You have the following options:
- Use mysql_convert_table_formatscript as described here. Then use the following command only if all tables in the database are ISAM or MyISAM tables
shell>mysql_convert_table_format database db_name
- To convert tables individually, use
mysql> ALTER TABLE tbl_name TYPE=MyISAM;
Make sure you are not using shared MySQL libraries (Perl DBD::mysql module, MySQLdb). Otherwise according to MySQL, "you should recompile them, because the data structures used in libmysqlclient.so."mysql> SHOW TABLE STATUS LIKE 'tbl_name';
MySQL UPGRADE GUIDE 1
MySQL Server Changes with MySQL4 onwards
- server by default no longer loads user-defined functions. “User-Defined Function Security Precautions”.
- many new privileges in the
mysql.user
table : “Privileges Provided by MySQL”. - safe_mysqld has been renamed to mysqld_safe
- "InnoDB support is included by default" (binary)
- mysqld option --temp-pool enabled by default(better performance with Linux).
- Startup options --skip-locking and --enable-locking have been renamed to --skip-external-locking and--external-locking
- External system locking of MyISAM/ISAM files is turned off by default. To turn it on, use
-external-locking
Name in 3.23 | Name in 4.0 (and above) |
myisam_bulk_insert_tree_size | bulk_insert_buffer_size |
query_cache_startup_type | query_cache_type |
record_buffer | read_buffer_size |
record_rnd_buffer | read_rnd_buffer_size |
sort_buffer | sort_buffer_size |
warnings | log-warnings |
--err-log | --log-error(for mysqld_safe) |
Why should you use truncate instead of delete
You should use TRUNCATE TABLE when you want to delete all rows from a table and you do not need to obtain a count of the number of rows that were deleted. (DELETE FROM tbl_name returns a row count in 4.0 and does not reset the AUTO_INCREMENT counter, and TRUNCATE TABLE is faster.)For Full Text indexes
Also see: “How to Make a Threaded Client”
To use MATCH ... AGAINST (... IN BOOLEAN MODE) full-text searches, you must rebuild existing table indexes using REPAIR TABLE tbl_name USE_FRM. If you attempt a boolean full-text search without rebuilding the indexes in this manner, the search returns incorrect results. See “Fine-Tuning MySQL Full-Text Search”.
Comments and Errors
.
Download MySQL from here.
wget http://dev.mysql.com/..../MySQL-server-5.0.15-0.i386.rpm
Now lets verify the integrity of the package using md5sum
[root@plain install]# md5sum MySQL-server-5.0.15-0.i386.rpmNow verify that the MD5 checksum listed matches the MD5 Checksum on MySQL site.
13971fd27ff2dc38537ff157ef6b715a MySQL-server-5.0.15-0.i386.rpm
In our case the md5 checksums do match.
13971fd27ff2dc38537ff157ef6b715a == 13971fd27ff2dc38537ff157ef6b715a
Therefore we can continue with the installation.MySQL won't let you have both servers on one machine as we get the following error when installing MySQL 5 on top of MySQL 3
[root@plain install]# rpm -ivh MySQL-server-5.0.15-0.i386.rpm
warning: MySQL-server-5.0.15-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
MySQL conflicts with mysql-3.23.58-2.3
MySQL-server conflicts with mysql-server-3.23.58-1
We get the following errors when trying to uninstall MySQL
[root@plain install]# rpm -ev mysql
error: Failed dependencies:
libmysqlclient.so.10 is needed by (installed) perl-DBD-MySQL-2.1021-3
libmysqlclient.so.10 is needed by (installed) libdbi-dbd-mysql-0.6.5-5
libmysqlclient.so.10 is needed by (installed) MySQL-python-0.9.1-6
libmysqlclient.so.10 is needed by (installed) MyODBC-2.50.39-12
libmysqlclient.so.10 is needed by (installed) mysql-server-3.23.58-1
mysql = 3.23.58 is needed by (installed) mysql-devel-3.23.58-2.3
mysql is needed by (installed) MySQL-python-0.9.1-6
mysql = 3.23.58 is needed by (installed) mysql-server-3.23.58-1
To fix this, we need to uninstall MySQL 3.23 and all dependencies
rpm -ev mysql perl-DBD-MySQL-2.1021-3 libdbi-dbd-mysql-0.6.5-5 MySQL-python-0.9.1-6 MyODBC-2.50.39-12 mysql-server-3.23.58-1 mysql-devel-3.23.58-2.3 MySQL-python-0.9.1-6 mysql-server-3.23.58-1Now lets get the other MySQL utilities
Benchmark suits
Downloading
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-server-standard-5.0.15-0.rhel3.i386.rpm/from/ftp://ftp.orst.edu/pub/mysql/
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-client-standard-5.0.15-0.rhel3.i386.rpm/from/ftp://ftp.orst.edu/pub/mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm/from/pick/ftp:/ftp.orst.edu/pub/mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-devel-standard-5.0.15-0.rhel3.i386.rpm/from/pick/ftp:/ftp.orst.edu/pub/mysql/
You should have the following RPMs now for MySQL
[root@plain mysql]# ls
MySQL-bench-5.0.15-0.i386.rpm MySQL-server-standard-5.0.15-0.rhel3.i386.rpm
MySQL-client-standard-5.0.15-0.rhel3.i386.rpm MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm
Calculate MD5
Verify all the packages using MD5
[root@plain mysql]# md5sum MySQL-*
3b02c71d5d5354bcd8ce9a534a999d74 MySQL-bench-5.0.15-0.i386.rpm
c7a0047f24d2ba0494829eb5a9c572bf MySQL-client-standard-5.0.15-0.rhel3.i386.rpm
b13df3d95bb8fca02d23546b84931140 MySQL-server-standard-5.0.15-0.rhel3.i386.rpm
109ca0273a6a7c460e4afaef3def88b3 MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm
51772ca969fa08a13064410469d79191 MySQL-devel-standard-5.0.15-0.rhel3.i386.rpm
Now lets install the MySQL 5 RPM
Notice we got an error for the benchmarks one. We will investigate this later.
[root@plain mysql]# rpm -ivh MySQL-client-standard-5.0.15-0.rhel3.i386.rpm
warning: MySQL-client-standard-5.0.15-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-client-standard ########################################### [100%]
[root@plain mysql]# rpm -ivh MySQL-server-standard-5.0.15-0.rhel3.i386.rpm
warning: MySQL-server-standard-5.0.15-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server-standard ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h server password 'new-password'
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
Starting MySQL.[ OK ]
[root@plain mysql]# rpm -ivh MySQL-devel-standard-5.0.15-0.rhel3.i386.rpm
warning: MySQL-devel-standard-5.0.15-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-devel-standard ########################################### [100%]
[root@plain mysql]#
[root@plain mysql]# rpm -ivh MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm
warning: MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-shared-standard ########################################### [100%]
[root@plain mysql]# rpm -ivh MySQL-bench-5.0.15-0.i386.rpm
warning: MySQL-bench-5.0.15-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
MySQL-client is needed by MySQL-bench-5.0.15-0
[root@plain mysql]#
Now we can confirm that the MySQL RPMs have been installed.
[root@plain mysql]# rpm -qa | grep -i mysql
MySQL-client-standard-5.0.15-0.rhel3
MySQL-server-standard-5.0.15-0.rhel3
MySQL-shared-standard-5.0.15-0.rhel3
MySQL-devel-standard-5.0.15-0.rhel3
END
EV1 - MySQL4
6 comments:
Thanks - as a newbie to Red Hat - and as RH AS came with MySQL 4.x on it - following your instructsion made it easy to get to MySQL 5.0.19 Thanks
Thanks for the manual. One question though: does it mean I can insall other mysql dependent packages such as php-mysql?
Correct installation steps for MySQL 5.0.24 on RedHat Enterprise Linux 4 with RPM:
Pre-reqs:
1. If you have /etc/my.cnf, delete it.
2. If you have /var/lib/mysql directory, remove it.
Then do:
1. /usr/sbin/setenforce 0
2. rpm -Uvh MySQL-server-standard-5.0.24-0.rhel4.i386.rpm MySQL-client-standard-5.0.24-0.rhel4.i386.rpm
3. /usr/sbin/setenforce 1
The server then starts okay once the rpm installation is complete.
Good work Frank, thank's for all the help, but one note that conflicts with your procedure:
MySQL says it's preferable to install the Server RPM first, not the client...
Guys,
I am trying to upgrade mysql3 to mysql5 on RHEL3, but the problem is all the rpms i have downloaded are not complying with md5sum check. I have tried downloading couple of times from different mirrors but still its giving same following error for all of them
rpm -Uvh MySQL-client-community-5.0.41-0.rhel3.i386.rpm
error: MySQL-client-community-5.0.41-0.rhel3.i386.rpm: V3 DSA signature: BAD, key ID 5072e1f5
error: MySQL-client-community-5.0.41-0.rhel3.i386.rpm cannot be installed
any one had this problem before?
Regards,
Laibhari
I installed the MySQL community 5.0.51a according to the above instructions above. All went well except that I want to run the benchmark Perl test suite. According to the manual, the test suite should be in sql-bench but I could not find it. (I did install the MySQL-test-community-5.0.51a-0...).
Thanks in advance,
-Hung
Post a Comment