Bug #64709 Not able to remove old version of mysql from linux OEL
Submitted: 20 Mar 2012 18:27 Modified: 23 Mar 2012 13:59
Reporter: Dhananjay Semwal Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:MySQL-server-5.5.20-1.linux2.6.x86_64 OS:Linux (OEL)
Assigned to: CPU Architecture:Any

[20 Mar 2012 18:27] Dhananjay Semwal
Description:
Hi,

I Think i have installed a wrong version of my sql in the linux server, however now trying to remove it its not working. because when i try to install teh correct version it says its conflicting with old files of previous version. Below are the details.

Server: [root@emsbaygsam08 dj]# uname -a
Linux emsbaygsam08 2.6.18-238.el5 #1 SMP Tue Jan 4 15:41:11 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@emsbaygsam08 dj]#

Issue I am getting is[root@emsbaygsam08 dj]# rpm -qa | grep -i mysql
MySQL-server-5.5.20-1.linux2.6
[root@emsbaygsam08 dj]# rpm -e MySQL-server-5.5.20-1.linux2.6
error reading information about service mysql: Invalid argument
error: %preun(MySQL-server-5.5.20-1.linux2.6.x86_64) scriptlet failed, exit status 1
[root@emsbaygsam08 dj]#
 

How to repeat:
follow the below steps to repeat 

[root@emsbaygsam08 dj]# rpm -qa | grep -i mysql
MySQL-server-5.5.20-1.linux2.6
[root@emsbaygsam08 dj]# rpm -e MySQL-server-5.5.20-1.linux2.6
error reading information about service mysql: Invalid argument
error: %preun(MySQL-server-5.5.20-1.linux2.6.x86_64) scriptlet failed, exit status 1
[root@emsbaygsam08 dj]#
[21 Mar 2012 10:29] Dhananjay Semwal
Hi There,

any news on this please help me figure this out.
[21 Mar 2012 14:18] Dhananjay Semwal
Hello Guys,

Please suggest me some thing, I am not able to install it. we have to go live in next two days and  i need to set this up before that.
[21 Mar 2012 17:17] Dhananjay Semwal
error log my sql while starting the server

Attachment: mysql-error.log (application/octet-stream, text), 10.96 KiB.

[21 Mar 2012 17:20] Dhananjay Semwal
I have installed the mysql successfully however not able to start it, i removed the old version which i have installed mistakenly.

Issue is server is not getting started. Below are details

[root@emsbaygsam08 rc3.d]# rpm -qa | grep -i mysql
MySQL-server-5.5.21-1.rhel5
MySQL-devel-5.5.21-1.rhel5
MySQL-client-5.5.21-1.rhel5
MySQL-shared-5.5.21-1.rhel5
[root@emsbaygsam08 rc3.d]# uname -a
Linux emsbaygsam08 2.6.18-238.el5 #1 SMP Tue Jan 4 15:41:11 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@emsbaygsam08 rc3.d]# ./S64mysql start
Starting MySQL...The server quit without updating PID file [FAILED]b/mysql/emsbaygsam08.pid).
[root@emsbaygsam08 rc3.d]#

i have attached the logs which i get after trying to start the server
[22 Mar 2012 17:04] Arnaud Adant
Hi Dhananjay,

I tested on OEL 5.6 as root :

downloaded MySQL-5.5.20-1.linux2.6.x86_64.tar 

tar xvf MySQL-5.5.20-1.linux2.6.x86_64.tar
 
rpm -i *.rpm

/etc/init.d/mysql start

I created one table then

rpm -e MySQL-shared-5.5.20-1.linux2.6
rpm -e MySQL-embedded-5.5.20-1.linux2.6
rpm -e MySQL-devel-5.5.20-1.linux2.6
rpm -e MySQL-test-5.5.20-1.linux2.6
rpm -e MySQL-client-5.5.20-1.linux2.6
rpm -e MySQL-server-5.5.20-1.linux2.6

rm -rf MySQL*.rpm

then

downloaded MySQL-5.5.21-1.rhel5.x86_64.tar  

tar xvf MySQL-5.5.21-1.rhel5.x86_64.tar
rpm -i *.rpm

/etc/init.d/mysql start

I could not reproduce your uninstall problem. Note that you could have tried to upgrade the package using rpm -U.

About the next problem, it seems that mysql database tables are missing.
If it is a fresh installation, you can run mysql_install_db as root to recreate them.

Please note the recommended script to run mysql is :

/etc/init.d/mysql start

If it does not work, can you paste the directory listing of /var/lib/mysql ?
[22 Mar 2012 17:05] Arnaud Adant
Of course, if the database already contained data, you need to restore.
[22 Mar 2012 17:24] Arnaud Adant
By the way, did not you rename /etc/init.d/mysql to another name ?

This would explain the failure to uninstall the first RPM ?

rpm -e needs to shutdown the server and uses /etc/init.d/mysql stop.
[23 Mar 2012 12:21] Dhananjay Semwal
Hi,
Thanks for your reply, i was not well yesterday so was not in office.
yes this is a fresh installation now
as per your suggestion i tried running the mysql_install_db  command and it ran succesfully, however I am still not able to start teh service. below is what i am gettiong as error. my S64mysql  is pointing to /etc/init.d/mysql only

[root@emsbaygsam08 rc3.d]# pwd
/etc/rc3.d
[root@emsbaygsam08 rc3.d]#
lrwxrwxrwx  1 root root   15 Mar 21 15:52 S64mysql -> ../init.d/mysql

[root@emsbaygsam08 rc3.d]# ./S64mysql start
Starting MySQL...The server quit without updating PID file [FAILED]b/mysql/emsbaygsam08.pid).
[root@emsbaygsam08 rc3.d]#

Below are the dir listing which you have asked for . also attaching the error logs from emsbaygsam08.err file, please see the attached file as well, this is bit urgent now, please help me

[root@emsbaygsam08 rc3.d]# cd /var/lib/mysql/
[root@emsbaygsam08 mysql]# ls -lart
total 28812
drwxr-xr-x 20 root  root      4096 Feb  7 14:52 ..
drwxr-xr-x  2 mysql mysql     4096 Mar 21 15:01 test
-rw-rw----  1 mysql mysql  5242880 Mar 21 15:02 ib_logfile1
-rw-r--r--  1 mysql mysql      393 Mar 21 15:52 RPM_UPGRADE_MARKER-LAST
-rw-r--r--  1 mysql mysql      717 Mar 21 15:52 RPM_UPGRADE_HISTORY
drwx------  2 root  root      4096 Mar 23 12:12 performance_schema
drwx--x--x  2 mysql mysql     4096 Mar 23 12:12 mysql
-rw-rw----  1 mysql mysql  5242880 Mar 23 12:15 ib_logfile0
-rw-rw----  1 mysql mysql 18874368 Mar 23 12:15 ibdata1
-rw-rw----  1 mysql mysql    19668 Mar 23 12:15 emsbaygsam08.err
drwxr-xr-x  5 mysql mysql     4096 Mar 23 12:15 .
[root@emsbaygsam08 mysql]#
[23 Mar 2012 12:22] Dhananjay Semwal
mysqlerror log file

Attachment: mysql-error.log (application/octet-stream, text), 2.28 KiB.

[23 Mar 2012 13:31] Arnaud Adant
Hi Dhananjay,

Can you try this ?

chown -R mysql /var/lib/mysql
chgrp -R mysql /var/lib/mysql

If it does not work, can you send this output and error log ?

ls -al /var/lib/mysql/
ls -al /var/lib/mysql/mysql/
[23 Mar 2012 13:47] Dhananjay Semwal
Hi Arnaud,

you know what, you are simply a genius, it was simple thing and i had more visibility  of this. Thanks so much it worked. Thanks a ton for all your help, I will quickly now setup the database and hopefully i should be all set and done.

Thanks,
Dhananjay
[23 Mar 2012 13:58] Arnaud Adant
Hi Dhananjay,

You are most welcome. If you wish faster responses, take a look at our support offers :-). I am closing this bug.

Best regards,

Arnaud