Linux ‘make clean’ is your Friend – MySQL Lenny Backports

Two days ago I had started work to upgrade the database on the development server. We plan to use Amazon’s RDS (Relational Database Server) which only runs limited versions for MySQL. As of this writing they are 5.5.8, 5.1.50, 5.1.49 and 5.1.48. Before I was running MySQL 5.0 on both the development and production servers. As a web developer, I know it is best to use the same MySQL and PHP versions on the development server and the production server. This way, after you have tested and developed your code on the dev box you can rule out any problems you might encounter when you upload your code to production due to different versions of PHP or MySQL. It is also a good idea to match Apache versions but not too important to match Linux kernels or distributions, at least not in my line of work.

I usually use packages to install programs on the Linux boxes as I use Debian. Currently, I am using Debian Lenny (version 5.0) on both boxes. I have used packages to install everything except PHP. The Debian Lenny stable packages for MySQL are only for MySQL 5.0 but I needed to upgrade that so I could match the MySQL version that will be used on Amazon’s RDS. I searched the Debian site and came across Debian Backports. This is an answer to using newer packages that aren’t available to Lenny. I found that Backports has a package for MySQL 5.1.49. I thought, “perfect,” now I can just install MySQL Backports package for Lenny and now my database versions would be the same.

I had to modify my /etc/apt/sources.list to include:

deb http://backports.debian.org/debian-backports/ lenny-backports main

This was the right thing to do because when I went into aptitude and did a package update I was able to find the MySQL server and client 5.1.49. I went ahead and removed (purged) the old MySQL 5.0 packages and installed the following packages:

mysql-server-5.1
mysql-client-5.1
libmysqlclient-dev
libmysqld-dev

Each version was 5.1.49.

During install it asked me if I wanted to overwrite my my.cnf file. I guess I should have let it change it because when it tried to restart MySQL failed to start. I then kept trying to reinstall so it would go ahead and overwrite my old my.cnf file. I had to find an example MySQL conf file which can be located in /usr/share/doc/mysql-server-5.1/my-*.cnf. These files are example MySQL conf files for various size database servers. I chose the medium configure file as that best matched my old conf file. Doing so seemed to work as I was able to get MySQL running again.

I then went to access phpMyAdmin and it brought up a warning about how the PHP client didn’t match the MySQL version. So I knew I had to recompile PHP. I had used packages for everything except PHP because I had to customize PHP so much. I opened up a PHP dev file that uses the function phpinfo(). There I had the complete ./configure line that I used to originally compile PHP. After I ran the configure again, I ran make && make install. This went pretty fast but I didn’t think much of it. When I went to access my website I kept getting this error:

mysql_connect(): Headers and client library minor version mismatch

This one was the doozy. I searched and searched all over the internet to find an answer. I found a few things here and there which didn’t help. Everything I found is stuff I already did. I knew I had installed MySQL correctly with aptitude. I thought I was compiling PHP correctly. I couldn’t figure out why the PHP compilation was not using the new MySQL header code.

So after literally 8 hours of web searches, trial and error, and chatting on IRC with the nice guys at Cerberus who offer a CRM toolkit, I finally got my prayer answered. Yes, I said prayer. I prayed about it while in the bathroom. While chatting, I had asked how to remove something that was installed via a compile. He said to,

try make clean.

I tried it, it seemed to remove some things. Wouldn’t you know it, while running make && make install, it took considerably longer. I figured something new must be happening here. Apparently, that did the trick. I guess it recompiled the header files this time all the way around and overwrote the old ones that were left behind from the very first compile I did while I had MySQL 5.0 installed.

I really, really hope this post saves someone else a day’s work. If so, hit me up!

Advertisements

Computer Programming IT Specialist Computer Repair

Tagged with: , , , , , , , , , , , , , , , , ,
Posted in Technology
2 comments on “Linux ‘make clean’ is your Friend – MySQL Lenny Backports
  1. shrimpwagon, your article helped me explain much more clearly how and why “make clean” should be used. It was very difficult to put into words as I have taken it for granted. Sometimes, us nerds have a difficult time explaining these things and it takes a genius like you to bridge the gap between “it just makes this crap install/compile without issues, man” and your nice explanation. Thanks for the writing!

    • shrimpwagon says:

      Hey Dominic, sorry I didn’t respond to your comment sooner. Thank you for reading my post and commenting. Haha, I wasn’t too sure if anyone ever reads these things. I thought…I’ll give it a try.

      Yeah, man. Sometimes even us programmers and IT guys just want the basics, the need-to-know stuff. I once asked a colleague of mine about the differences of a switch and a router. He is in network security for the gov. He went on and on and on about all this crazy stuff about switches. Talking about QoS packets, fiber connections and stuff. Finally after just buying one. I found out all it really does essentially is give you more ports to plug crap in, as opposed to a 4 or 8-port router. Essentially, it turns your 4-port router into a 24-port router or whatever. I was like geez, dude could have just said that from the beginning and I would have been happy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

That’s Me Ya’ll

%d bloggers like this: