Documentation Home
MySQL and Windows
Related Documentation Download this Excerpt
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb
EPUB - 0.7Mb
HTML Download (TGZ) - 0.7Mb
HTML Download (Zip) - 0.7Mb

MySQL and Windows  /  Installing MySQL on Microsoft Windows  /  Upgrading MySQL on Windows

1.7 Upgrading MySQL on Windows

To upgrade MySQL on Windows, follow these steps:

  1. Review Upgrading MySQL, for additional information on upgrading MySQL that is not specific to Windows.

  2. You should always back up your current MySQL installation before performing an upgrade. See Database Backup Methods.

  3. Download the latest Windows distribution of MySQL from

  4. Before upgrading MySQL, you must stop the server. If the server is installed as a service, stop the service with the following command from the command prompt:

    shell> NET STOP MySQL

    If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from MySQL 4.1 to 5.0, use mysqladmin from MySQL 4.1 as follows:

    shell> "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqladmin" -u root shutdown

    If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and enter the password when prompted.

  5. Before upgrading to MySQL 5.0 from a version previous to 4.1.5, or from a version of MySQL installed from a Zip archive to a version of MySQL installed with the MySQL Installation Wizard, you must first manually remove the previous installation and MySQL service (if the server is installed as a service).

    To remove the MySQL service, use the following command:

    shell> C:\mysql\bin\mysqld --remove

    If you do not remove the existing service, the MySQL Installation Wizard may fail to properly install the new MySQL service.

  6. If you are using the MySQL Installation Wizard, start the wizard as described in Section 1.2.1, “Using the MySQL Installation Wizard”.

  7. If you are installing MySQL from a Zip archive, extract the archive. You may either overwrite your existing MySQL installation (usually located at C:\mysql), or install it into a different directory, such as C:\mysql5. Overwriting the existing installation is recommended.

  8. If you were running MySQL as a Windows service and you had to remove the service earlier in this procedure, reinstall the service. (See Section 1.4.7, “Starting MySQL as a Windows Service”.)

  9. Restart the server. For example, use NET START MySQL if you run MySQL as a service, or invoke mysqld directly otherwise.

  10. As Administrator, run mysql_upgrade to check your tables, attempt to repair them if necessary, and update your grant tables if they have changed so that you can take advantage of any new capabilities. See mysql_upgrade — Check Tables for MySQL Upgrade.

  11. If you encounter errors, see Section 1.5, “Troubleshooting a MySQL Installation Under Windows”.

Download this Excerpt
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb
EPUB - 0.7Mb
HTML Download (TGZ) - 0.7Mb
HTML Download (Zip) - 0.7Mb
User Comments
  Posted by Stuart Chase on April 21, 2005
If you do forget to remove the service. Especially when uninstalling and installing a fresh copy.

Goto regedit in:

Find mysql and delete. Reboot to take effect in services manager.
  Posted by Pornsak Puttaracha on August 15, 2005
"sc delete mysql" will delete the service and update the list without having to reboot the machine.

Note that the "sc" command was introduced in Windows XP.
  Posted by Gene Scharmann on October 23, 2005
The 'sc delete mysql' is also available in the Microsoft Windows 2000 Professional Resource Kit. (Not only XP)

  Posted by Bob Savard on January 6, 2006
This may seem obvious, but:

Step 6 says to overwrite your existing MySQL install, but if
you do, you'll overwrite any security changes you may have made to the mysql database (most probably the user and db tables). So only overwrite them if you know you haven't made any changes to that database.
  Posted by Mike Hebblethwaite on January 8, 2006
You do not need to uninstall the service
Simply change the my.ini file in C:\windows\my.ini

Then copy the new mysqld-nt.exe to the oldversion/bin/ folder.

Change the line basedir=C:/apache/mysql to
for example or whatever you called the new folder.

Leave the data folder path the same if you want
datadir=C:/apache/mysql/data or

datadir=C:/apache/newversion/data if you want a new mysql without any data in it.

That way if the new version makes new issues for you (errors) just change the my.ini path back to the old version's folder.

In simple terms there is no need to change your data folder and so you keep all the info and users data safe.

Updating the mysql_fix_privilege_tables is still the same problem for us though.
  Posted by Jacob Nikom on January 19, 2007
If during windows installation MySQL server refuses
to be connected to try to do the following:
1. Check that the MySQL server is running
->ControlPanel->Administrative Tools->Component Services->Services(local)

2. Use the client command without password:
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" -u root

By default MySQL installation creates the following privileges:
mysql> select user, host, password from user;
| user | host | password |
| root | localhost | |
1 row in set (0.00 sec)

Once you got in you can change the privileges and create secure

  Posted by Phil Collett on May 11, 2007
I had some fun upgrading from mysql-4.1.15-win32 (mysql 4.1) to mysql-5.0.41-win32. I figured I would write down what I did to save people time. The permissions table thing is still tricky. I used the no-installer to get the version 5 mysql. Then I just swapped the installs as I had done in the past. when I relaunched mysql (mysql5/bin/mysqld-nt --console) I kept getting Error 1130 [HYO 000x] cannot logon locally errors. So this was the mysql permission tables upgrade problem. After attacking the upgrade from a few differnt angles I found the way that worked for me. This is detailed below.

The upgrade took me 15 minutes after I had my plan.

1. download mysql 5 no install.
2. unzip it.
3. export you mysql.db and mysql.user tables using whatever tool you use (make import of old users permissions and table rights)
so you get something like (I used EMS extract)...

use mysql;
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`) VALUES
next rec..
next rec
# Data for the `db` table (LIMIT 0,500)
INSERT INTO `user` (`Host`, `User`, `Password`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`) VALUES
('%','parts','old-encrypted-password','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0), rec.....;

save as a text file somewhere.
4. open a command window and end the mysql service, if you run as service.
5. go to mysql install folder/bin and unregister whatever mysql daemon you are using
c:/mysql/bin/mysqld-nt --remove

6. zip up all your old mysql (basedir and DataDir) for
backup and later use.
7. find all your old my.cnf and my.ini files that were left over from previous installs and put them in you backup folder with the other ziped folders so the new install can't see them.

8. place mysql 5's unzipped stuff where ever you want it to run from (mine is c:/mysql5.

9. just let iot use the mysql and test databases at first to get mysql5 running.
10. Set up your my.ini file for mysql 5 and just leave it in the mysql directory (none in %sysroot% any more I guess.
11. start mysql5 in console c:/mysql5/bin/mysqld-nt --console.
12. Try to log into the console with a blank root password (since this is a fresh install).
13. assuming you got this far, type "SHOW DATABASES;" in mysql. Should only be Mysql and Test.
14. Copy you old databases except of course the 4.1 mysql and 4.1 test dbs (if it is still there) to you c:/mysql5/data/ directory.
15. check in mysql console if they can be seen by running "Show Databases;" again.
16. Hopefully that worked, no import your old db and user permission from the sql file you made earlier.
in mysql console: SOURCE "c:/your-file-path.txt";
that should bring in your old user and password in the old format.
17. check if you import worked by selecting from users (use mysql; select * from user;)
18. I was fine at this point besides the old password format, so I ran the Mysql_upgrade.exe file that is mentioned in here a million times, but omly worked for me this way.
18. I ran mysql_upgrade from a batch file:
C:\mysql5\bin\mysql_upgrade.exe --datadir=c:/mysql5/data/ --basedir=c:/mysql5/ -u root

19. a whole bunch of output about bad table struct, 4.1 style passwords and duplicate columns. when it finsihed I ran it again, and only got the dup column warnings which can be ignored. Then I ran it again just for fun.
20. at this point all the db's are in the right structure, my logins all worked.
21. closed my console session running mysql, closed my console window mysql was running in (--mysqld-nt --console) and moved my data directory back to which it came (personal choice).
22. Checked my cofig file (in mysql base dir ...c:/mysql5/my.ini) using "c/mysql5/mysqld-nt --print-defaults" and they looked fine, changed my datadir="x:/path", and re-ran the --print-defaults.
22. I then reinstalled the msyql as a service with the my.ini file still only in my basedir (c:/mysql5/bin/mysqld-nt --install), and started mysql (net start mysql) or services gui.
23. Last thing, make the root user a password, easily crackable of course like a bad word (don't really do this, but do make a password).

Hope that saves somebody else some time.
Citrus Motors
  Posted by Brian Wendt on February 5, 2010
If when you go to install again it can't start the service & it had asked you for the old root password, you need to delete the folder C:\ProgramData\MySQL
This took me 3 hours to discover, its BS that no one seems to have pointed out this fact.
  Posted by Jacob Pérez on January 12, 2012
For time reason I'll make my comment on spanish languaje, later I'll translate at english languaje.

I hope can help at someone this contribution:

Actualización de MySQL Server en Windows
1. Descargar la nueva versión de MySQL en archivo .zip
2. Detener el servicios de MySQL
a. Inicio – Panel de control – Sistema y seguridad – Herramientas administrativas – Servicios
b. Seleccionar el nombre del servicio de MySQL y detenerlo
3. Eliminar el servicio de MySQL
a. Inicio – Ejecutar
b. Escribir regedit y dar aceptar
c. Eliminar el siguiente registro HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Service
d. Reiniciar el equipo
4. Actualizar MySQL Server
a. Inicio – Equipo
b. Ubicarse en la ruta donde se instaló MySQL Server
C:\Program Files\MySQL\MySQL Server x.x
c. Abrir el archivo .zip y descomprimir el contenido en la carpeta donde está instalado MySQL Server
d. Reemplazar todos los archivos
5. Configurar el servicio e instancia de MySQL Server
a. Inicio – Todos los programas – MySQL – MySQL Server x.x - MySQL Instance Configuration Wizard
b. Siguiente – Siguiente – Siguiente – Siguiente – Siguiente
c. En algunos casos reconoce dónde ha sido instalado MySQL Server, por lo que bastará con dar Siguiente, en caso contrario dar Modificar – Sí – Siguiente
d. Siguiente – Indicar el puerto con el que se va a trabajar y agregar la excepción del puerto en Firewall – Siguiente
e. Indicar Selección manual de caracteres por defecto e indicar utf8 – Siguiente
f. Siguiente
g. Desmarcar Modicar las configuraciones de seguridad – Siguiente – Ejecutar

  Posted by Jacob Pérez on January 13, 2012
I'll post my suggest on English Language, for upgrading MySQL Server on Windows OS.

Upgrading MySQL Server on Windows
1. Donwload the new version of MySQL on zip format
2. Stopping MySQL Service
a. Start – All programs - Control Panel – System and security – Administrative tools - Services
b. Select the MySQL Services name and stopped
3. Delete MySQL service
a. Start – Run
b. Type regedit and Ok
c. Delete the next item HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Service
d. Restart the computer
4. Updating MySQL Server
a. Start - Computer
b. Look for the path was installed MySQL Server C:\Program Files\MySQL\MySQL Server x.x
c. Open the .zip file and uncompress the files on the folder was installed MySQL Server
d. Replace all the files
5. MySQL Instance Configuration
a. Start – All programs - MySQL – MySQL Server x.x - MySQL Instance Configuration Wizard
b. Next – Next – Next – Next – Next
c. Some times recognize the path where was installed MySQL Server, on this case clic on Next, if don’t recognize the path clic on Modify – Yes – Next
d. Next – Indicated the port for the MySQL Service and check Add firewall exception for this port – Next
e. Check Manual Selected Default Character Set / Collation and indicated utf8 on Character Set – Next
f. Next
g. Uncheck Modify Security Settings – Next – Execute

I hope can help at someone.
  Posted by Attila R on April 8, 2013
I did unzipped 5.6.10 onto an older version 5.6.x on Windows.

my.ini did't overwrote and contained these lines:

password = something

From this point I lost _ALL_ access to MySQL:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I mean mysql.exe or mysql_upgrade.exe also didn't worked.

I figured out the problem was the password line in my.ini. I did commented out temporarily, ran mysql_upgrade.exe then I did uncommented then everything worked well.
  Posted by 庭豐 石 on November 7, 2013
Point 5 in this article implies that when upgrading from 5.1 to 5.5, we need to uninstall MySQL Server 5.1 first. That is, we cannot run installer for 5.5 and expect it to *upgrade* installed version 5.1 to 5.5.

To those who want to remove my comment, read the following first:
Please refer to
In section of that article, please pay attention to the 2nd paragraph that I include here below:
Automatic upgrades are available only when upgrading between installations that have the *same major and minor version numbers*. For example, you can upgrade automatically from MySQL 5.1.5 to MySQL 5.1.6, but not from MySQL 5.0 to MySQL 5.1.

As a matter of fact, I have MySQL 5.1.30 in a test computer. I run MySQL 5.5 setup WITHOUT previously uninstalling 5.1. Result: both versions are displayed in "Add/Remove Program" applet (and the new server is not using old data, but this is another topic)
Sign Up Login You must be logged in to post a comment.