Install MySQL from archive file

By Daniel Vladimirov / a few months ago

This tutorial will show how to install MySQL Community Edition database server from an archive file on Windows.

The reason why I prefer to install it like this is because I don’t pollute my machine with additional software that installs itself as a Windows service and gets in my PATH without me wanting it there. What if I want multiple MySQL servers? What if I want multiple servers with different versions to test my applications? The benefits of having a database server that is completely independent are many, the drawback is that you need to configure it yourself – something that is mainly done by the automatic installer. Also updating is questionable, although doable and of course you have to start your server manually every time you start your machine. You can automate this if you want, but I prefer having a better boot up time than this small convenience, because I don’t need a database server each time I’m using my machine.

So, let’s get right into it.

The MySQL website has a good tutorial on how to install the server from an archive, but honestly I’ve never liked any of the official manuals for MySQL. I think they’re bloated, at times cryptic and the formatting of the pages could be done better, but still the guys at MySQL have an official guide on how to do this that spans up to 9 pages, maybe more. You can check it out HERE if you want.

I will try to condense this as much as I can and I’m sure you’ll find it quite easy actually. I’m going to show you how to install it using the minimum required parameters, anything else that you might need in the future can be added and configured separately.

First let’s head over to the MySQL website and download us an archive file

As of writing, this is the link for the download page for the community edition – Download MySQL

I’m going to use the 64 bit version for my configuration

After downloading the archive, extract the contents to a folder of your choosing. This will be your base folder for this database instance. Extract the archive so that your folder is the parent of all of MySQL’s folders. Usually the archive will have another parent folder inside it which I skip, because it’s not needed.

This is the folder structure I’m aiming for

Next, MySQL needs a configuration file for its startup and server options. When the server starts it will look in several places around your computer to find an option file, but we’ll just create it in the base directory. Create a file, with any text editor, name it my.ini and place it inside the base directory for the MySQL server with the following contents (notice the slashes)

Now, we need to initialize the data directory through MySQL and also generate a default random password for our root user.

Navigate to the bin directory in your base MySQL server folder, open a command line window, I like to use CMDER, it’s a really nice replacement tool for the default Windows CMD. Next type

The initialize command will create the data directory, specified in the configuration file and also set up a root user with a random password. The console command will direct the output of the operation to your console. Otherwise you need to look for the output in the newly created data directory, in a file with .err extension, which you can open with any text editor. This is important, because MySQL will direct the random root password there, or in this case, it will output it right in the console window.

You should now have the data directory, you specified in the my.ini file. While still in the /bin directory, you can now type the following to start your MySQL server instance

You will see some console output again, it should contain this

The server instance should be now ready for us to try to logon to, using the random root user password that was generated. Open up another CMD window and navigate again to the /bin directory and type

When you get prompted for a password, paste the random password that you received in the first console output, from the initialize command. In this case the password is T6TG2/z:pJRf, yours will be different of course.

You are now logged into the MySQL server instance with the root user. You can now change the password to something more easy to remember.

Where “test123” is your new password.

You can now type /q to quit the current session and log in again, using your new password to verify that everything is working.

To shutdown the database server, go back to the CMD window that you used to start it up and just press Ctrl+C. You will see some console output related to the server shutdown, which should end with

This is all that is needed for a minimal and non-intrusive installation of MySQL from an archive file. You can now create multiple instances, configure them in master-slave or multi-master modes and pretty much do whatever you like, without worrying of messing up your installation and even if you do – you can fire up a new instance in a matter of minutes, without messing up anything on your Windows environment.



About the author

Daniel Vladimirov

Software engineer and founder of

Click here to add a comment

Leave a comment: