Step by Step Installation for MySQL 8 (Zip) on Windows
Although it is better for the un-nuanced users to use the MySQL installer, there are times when you want control or may have some personal reasons to use a non-installer version.
Note: The below steps have been tried on Windows Server 2012 and Windows 10 PRO, and MySQL 8 version. They should work on similar variants as well.
1. Download the ZIP from Oracle -Download MySQL Community Server
(I used the Windows x86, 64-bit, ZIP Archive option)
2. Extract the zip where needed (mine goes at C:\DEV_TOOLS\mysql-8.0.15-winx64);
3. Since this is not a complete installer, we will need to create certain things manually to enable it to work. These include creating a Data directory along with a local my.ini configuration as required.
4. Create a new directory at "\mysql-8.0.15-winx64\data" and a custom INI text file at "\mysql-8.0.15-winx64\my.ini"
5. Populate your custom settings in the "my.ini" as need be, it is your personal thing to use!
6. Open a command prompt; go to the bin folder "\mysql-8.0.15-winx64\bin".
Now INIT the DB using either "mysqld --initialize" or "mysqld --initialize-insecure" commands.
Note: At this point, you may run into the "msvcp120.dll missing" alert while firing up mysqld.
To solve this, hunt down the VC++ runtime libraries and install the same. Do keep in mind the 32 and 64-bit variance as the binaries differ for both.
7. Again, it is your choice if you want a random password to login or need no password to be set.
- If you choose the former, the password will be written to the default run log, the *.err file in your Data folder.
- If you choose the latter, i.e. "mysqld --initialize-insecure" you *will* need to create a password later.
Note: Just to share, I prefer using the "mysqld --initialize" method.
8. After the initialization is complete, the cursor will return to the prompt. Now, enter the command mysqld without any arguments. If all goes well, your cursor will NOT return to the prompt, but will appear suspended (in the background). If it returns back, you have some issue; go to the error log(s) to check.
9. Here with me so far? Great. Now check the same log file and you should find the following message with the password there -
"A temporary password is generated for root@localhost - XXXXXXXXXXX"
10. Open another command prompt and navigate back to the "\bin" directory. Reaching there, type the command "mysql -u root -p" and use the password from the previous step / log file at the prompt and complete the login.
11. You should be logged in now to the MySQL instance (yeah!). Once in, we need to update the root credentials as the password is temporary and you will not be able to use any external client until you change it.
12. To change it, run the query -
"ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_NEW_PASS';"
And you are all set!
Please do keep in mind that this is by no means a comprehensive set of steps for all ends. The intent is to help and get this setup working rather than exploit the various available configurations and options.
I hope this helps you know your environment setup better and gives you a sense of control!