I need to upgrade mysql

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
WHM 10.8.0 cPanel 10.9.0-R79
CentOS 3.8 i686 - WHM X v3.1.0

I'm having problems with mysql and my host suggests I upgrade it to 4.1

I searched the forums here and didn't find easy instructions. In WHM I see this:

MySQL Version to use (you must run Software/Update Server Software (or /scripts/mysqlup) for this to take affect. You should then run buildapache/easyapache after changing this option. You may also need to run /scripts/perlinstaller --force Bundle::DBD::mysql. Updating from a previous version of MySQL to a later version is not automatically reversable. You should backup your databases if you think you might wish to downgrade in the future.
5.0 4.1 4
Use old style (4.0) passwords with mySQL 4.1+ (required if you have problems with php apps authenticating)


The instructions and notes are confusing and kind of scary too because it looks like I might break something if I don't do this exactly right. Can someone give me step by step idiot instructions to upgrade Mysql either in WHM or in shell?
 

celliott

Well-Known Member
Jan 2, 2006
460
0
166
United Kingdom
Hi,

You can use these instructions I wrote a while back:

1. Create a backup of your current databases. I did this by backing up the /var/lib/mysql folder into a tar archive. Its advisable to stop MySQL first, to files in use can be read and databases cannot be changed whilst you upgrade.

Do this using: tar -czf archivename.tar.gz /var/lib/mysql

2. Go to WHM > Tweak Settings and tick MySQL 4.1. Click ok, wait 30sec and click the link as instructed. When thats completed open /etc/my.cnf with pico/nano and insert old-passwords under the mysqld tag. e.g.:

[mysqld]
old-passwords

Then Save and exit.

3. Login to SSH and run /scripts/mysqlup

4. Recompile apache either with Apache Update in WHM or Easyapache, both do practically the same thing.

When I migrated my servers to 4.1 I also had to update perl which you can do by this:

wget http://layer2.cpanel.net/perl587installer.tar.gz
tar zxf perl587installer.tar.gz
cd perl587installer
./install

If anything goes pearshaped you have a backup you can roll back on later :)

Chris.
 
Last edited:

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
Well this is annoying. I have everything open and ready to start the upgrade. But how do you stop mysql? The command service mysql stop says bash: service: command not found :confused:
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
77
308
cPanel Access Level
Root Administrator
You might want to upgrade to MySQL 5.0 instead as MySQL will stop supprting 4.1 at the end of this month.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
77
308
cPanel Access Level
Root Administrator
That may break a lot of users' scripts. I've had scripts break after major mysql upgrades before. :(
Tue, which is why after a major MySQL upgrade, one should rebuild PHP. If you keep the old mysql extension, enable the new extension(s) and place MySQL in "compatibility" mode (enable old password hashing) it should minimize breakage.
 

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
[edit]
Editing out the first part of my post, I think I just solved the problem I was asking about
[/edit]


But while I'm posting, these are the steps I've typed into a txt document, are they exactly correct (except for the wrong stop mysql command)?



/etc/int.d/mysqld stop
/etc/init.d/chkservd stop

==========================

tar -czf mysqlbackup.tar.gz /var/lib/mysql

==========================

Go to WHM > Tweak Settings and tick MySQL 5.0. Click ok, wait 30sec and click the link as instructed.

==========================

open /etc/my.cnf with nano and insert old-passwords under the mysqld tag. e.g.:

[mysqld]
old-passwords

==========================

Login to SSH and run /scripts/mysqlup

==========================

WHM >> Recompile apache
 
Last edited:

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
Do you get anythign with
Code:
ps ax | grep mys
?

[email protected] [/home/cathy]# ps ax | grep mys
11670 ? S 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/server6.affiliate-sites.net.pid
11696 ? S 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server6.affiliate-sites.net.pid --skip-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
11697 ? S 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server6.affiliate-sites.net.pid --skip-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
11698 ? S 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server6.affiliate-sites.net.pid --skip-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
11813 ? S 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server6.affiliate-sites.net.pid --skip-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
24068 pts/0 D 0:00 grep mys
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
77
308
cPanel Access Level
Root Administrator
Try

Code:
service mysql stop
If your mysql init file is indeed gone then you'll need to kill the processes manually.
 

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
Try

Code:
service mysql stop
If your mysql init file is indeed gone then you'll need to kill the processes manually.

service mysql stop says bash: service: command not found

I also tried mysqld instead of mysql

I could do killall mysql but that only works for a second. This is getting frustrating. :(

I wonder if the missing mysql init file is why I'm having problems with mysql in the first place?
 

randomuser

Well-Known Member
Jun 25, 2005
147
0
166
service mysql stop says bash: service: command not found
The command isn't found because it's not in your $PATH. To see your path, type: echo $PATH

When you get a "command not found", you'll need to specify the full path to the command. But first you need to find the command of course:

# whereis service
service: /sbin/service

Now you need to know what the mysql service name is:

# ls -al /etc/rc.d/init.d | grep mysql

Whatever the name is that returns, do:
/sbin/service mysql_service_name stop
 

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
Now you need to know what the mysql service name is:

# ls -al /etc/rc.d/init.d | grep mysql

Whatever the name is that returns, do:
/sbin/service mysql_service_name stop
This is what I got:

[email protected] [/home/cathy]# ls -al /etc/rc.d/init.d | grep mysql
-rwxr-xr-x 1 root root 5575 May 6 2006 mysql*


I'm not understanding the mysql service name from that. :confused:

ETA:

I tried this:

[email protected] [/home/cathy]# /sbin/service mysql restart
Killing mysqld with pid 16163
Wait for mysqld to exit done

That seems to work so I think I understand now what you were getting at.
 
Last edited:

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
Ok, I think I got it done without breaking anything.

This has been a learning experience! Thank you everyone for your help and patience!