Upgrading PHP and MYSQL on Windows

This article will explain the easy way to upgrade PHP and MYSQL on Windows Servers. Easy if you followed my installing PHP and instaling MYSQL tutorials.

If you follow this procedure you can have PHP and MYSQL upgraded in less than an hour.

Of course that doesn’t include the time it takes to download PHP and MYSQL. I will assume you have them downloaded. Lets get started. We’ll upgrade MYSQL first.

Upgrading MYSQL
As I said I assume you have the MYSQL zip already download. Use the zip nenver the installer. Extract the zip. You will have a directory called mysql-noinstall-4.1.16-win32 or something similar. The 4.1.16 will change depending on the version you downloaded. Inside that there will be mysql-4.1.6-win32 directory. Again the version number might be different. Rename mysql-4.1.6-win32 to mysql-4.1.16 and copy it to where ever you installed the version you want to upgrade. If your old version is at c:\mysql then copy the dir to C:\mysql-4.1.16.
Now copy my.ini from the old version of MYSQL to the new version. Open my.ini with Notepad and change

socket =

to reflect the new path to MYSQL. Example:

socket = C:/mysql-4.1.6/mysql.sock

Now we want to shutdown mysql. Open a command prompt and give this command.

C:\mysql\bin\mysqladmin -u root shutdown

Now all we have to do is uninstall the old service and install the service for the new version. First stop the MYSQL service.

net stop mysql

This will stop the MYSQL service. It might be a good idea to shutoff IIS first or you’ll get MYSQL errors on your site.
After the service is stopped then we want to uninstall the old service. At the command prompt use this command.

C:\mysql\bin\mysqld-max-nt.exe –remove

Now this assumes you installed mysqld-max-nt binary as the service. If you installed mysqld then adjust the command above to reflect the binary you used.
Once the old service is removed we can install the new service. First we want to make sure the new version of mysql runs without any problems. Give this command.

C:\mysql-4.1.16\bin\mysqld –console

After a short time you should see mysqld: ready for connections. If you see that then shutdown MYSQL so that we can move your databases and install the new service to finish up.
Once you know the new version of MYSQL works and have shutdown the new version it is time to move your database. Move into the old version of MYSQL and right click the data dir and select copy. Move into the new version of mysql and paste it overwriting the current data dir. That’s it. Once you have MYSQL upgraded and running you might want to optimize each database.
The last step. Install the new service and change the MYSQL path. To install the new service give this command.

C:\mysql-4.1.16\bin\mysqld-max-nt.exe –install

Yuor websites will now use the new version of MYSQL. Last thing you want to do is change the path variable to the new version. If you followed the tutorial to install MYSQL you’ll already have a path variable set to the old version. Just follow the procedure in instaling MYSQL to change the variable. If you don’t have the path variable follow the instaling MYSQL to set it.
MYSQL is now upgraded. Restart IIS, if you shut it down, and open a browser and navigate to your site. Everything should be running normally.
Next step is upgrading PHP. Lets get started.

Leave a Reply

1 Comment on "Upgrading PHP and MYSQL on Windows"

Notify of

[…] http://adminreports.com/upgrading-php-and-mysql-on-windows/ Posteado en 2003 Server, General, Windows […]