Upgrade mysql 4 to mysql 5

Richard G

Verified User
Joined
Jul 6, 2008
Messages
12,795
Location
Maastricht
I would like to upgrade mysql 4.1.10 to mysql 5 on a Debian machine with Directadmin Custombuild.

But I don't want to do anything wrong so if anybody could check if my procedure is oke? This is what i thought to do:

1.) Backup the mysql databases (do I do this manual of via options.conf?)
2.) from the howto:
cd /usr/local/directadmin/custombuild
./build update
./build clean
./build mysql d
./build php n
3.) restart mysql and maybe apache.

Is this all, or do I have to check or do other things? I presume I don't need to use apt-get.

Are the 4.1.10 databases automatically converted to mysql 5? Or do I need to put the backup into the new version?
If yes, do I need to do any converting of the database to mysql 5 myself?

Or is the above procedure complete and correct?

These are lines about php and mysql from my options.conf:
Code:
#PHP settings. default_php possible values - 4 or 5
default_php=5
php4_cli=no
php4_cgi=no
php5_cli=yes
php5_cgi=no
zend=no

#Possible values - 4.1, 5.0 or 5.1
mysql=5.0
mysql_inst=no
mysql_backup=no

#Possible values - 1.3, 2.0 or 2.2
apache_ver=2.2

Strange to that it says mysql=5.0 whilest 4.1.10 is installed. Do I need to change anything here in the options.conf prior or after the upgrade?
 
If you want to install/upgrade MySQL using the CustomBuild script, mysql_inst needs to be set to yes:

Code:
./build set mysql_inst yes
 
Thank you for the quick support! I will change that in the options.conf.
For the rest my procedure is ok?
I don't need to set mysql_backup=yes also?
 
It's recommended to set it to yes, because it backups your MySQL data before an upgrade.
 
Oke thank you, after that my procedure is correct and complete?
I really don't want to make mistakes.;)
 
Oke I got some error notices but it seems everything went oke. This is what happened after the ./build mysql d command:

Giving mysqld a few seconds to start up...
Looking for 'mysql' as: /usr/local/mysql/bin/mysql
Looking for 'mysqlcheck' as: /usr/local/mysql/bin/mysqlcheck
Running 'mysqlcheck'...
/usr/local/mysql/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
Restarting MySQL.
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
It is recommended to do "./build php n" after MySQL update.

Seems something went wrong with the mysqlcheck. I don't know why the "fatal error upgrade failed" is shown because mysql seems to run fine.

So I just started the ./build php n like advised, no problems there.

No further error notices, and for the rest it seems everything is working as designed. Forums with mysql and php are working fine too it seems.

But just to be sure I post these errors here, maybe there is a little bug in the upgrade script or am I mistaken in my idea that all is fine and is there still something that went wrong?

Or do I not need to worry?
 
You don't need to worry at all, but there is something that has to be done as soon as possible to be sure that everything is (and will remain) working correctly.
Code:
/usr/local/mysql/bin/mysql_upgrade
/usr/local/mysql/bin/mysqlcheck -A
This will check any table in any database for errors and upgrade, when needed, the table format. Because you upgraded the MySQL daemon and distribution, but your database is still in the old format. This usually creates corrupted tables or just indexes, but can be solved by running these two commands.
 
Last edited:
Thank you, however the correct command shout be then:
Code:
/usr/local/mysql/bin/mysql_upgrade -u da_admin -p
Otherwise an error occurs that root@localhost has access denied.

I run both commands and they fixed everything, thank you very much Tillo, because I did not know about those lines!
 
Back
Top