This quick guide will teach you how to configure and run a MySQL server from a noinstall ZIP archive on Windows.


Reference


https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html


Download the ZIP Archive


Firstly, download the MySQL Community Server 8.0.15 ZIP archive and extract it to the desired location for your installation (e.g. C:\Users\user.name\AppData\Local\Programs\mysql), then create the following directories:

  • MySQL Database data files: C:\Users\user.name\AppData\Local\Programs\mysql\db
  • MySQL Log files:  C:\Users\user.name\AppData\Local\Programs\mysql\logs

Create the configuration file


You'll need to create the required configuration file at C:\Users\user.name\AppData\Local\Programs\mysql\config.ini:


[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# set basedir to your installation path
basedir = "C:\\Users\\christopher.rowles\\AppData\\Local\\Programs\\mysql\\mysql-8.0.15-winx64"
# set datadir to the location of your data directory
datadir = "C:\\Users\\christopher.rowles\\AppData\\Local\\Programs\\mysql\\db"
# The port number to use when listening for TCP/IP connections. On Unix and Unix-like systems, the port number must be
# 1024 or higher unless the server is started by the root system user.
port = "3306"
# Log errors and startup messages to this file.
log-error = "C:\\Users\\christopher.rowles\\AppData\\Local\\Programs\\mysql\\logs\\log.err"

[mysqladmin]
user = "root"
port = "3306"
    

Initialise MySQL


You'll now need to initialise the MySQL database files:

  1. Open Windows command prompt (Hit Win + R, then type 'cmd' and press enter).
  2. Type the following command to initialise the files:
    "C:\Users\user.name\AppData\Local\Programs\mysql\mysql-8.0.15-winx64\bin\mysqld.exe" --defaults-file="C:\Users\user.name\AppData\Local\Programs\mysql\config.ini" --initialize-insecure --console

The command above should:

  • Create database files in the location specified in config.ini.
  • Initialise the root user with no password.
  • Log any errors to the current console.

Configure startup/shutdown scripts


Finally, create two batch scripts to manage your MySQL instance:


mysql-start.cmd:

"C:\Users\user.name\AppData\Local\Programs\mysql\mysql-8.0.15-winx64\bin\mysqld.exe" --defaults-file="C:\Users\christopher.rowles\AppData\Local\Programs\mysql\config.ini"

mysql-shutdown.cmd:

"C:\Users\user.name\AppData\Local\Programs\mysql\mysql-8.0.15-winx64\bin\mysqladmin.exe" --defaults-file="C:\Users\christopher.rowles\AppData\Local\Programs\mysql\config.ini" shutdown

These scripts can be invoked directly to start/stop your MySQL instance.


Finished


You should now have a functioning MySQL instance!


Please be aware that this guide does not provide a secure, production-ready configuration for your MySQL instance, it is only intended for development purposes.


Extra Steps


This guide showed you how to configure a basic MySQL instance with no password required for the root user, if you would like to configure the root user to use a password, follow these extra steps:

  1. Alter your config.ini file and include the following at the bottom of the [mysqld] section:
    default_authentication_plugin=mysql_native_password
  2. Execute the following query, replacing 'password' with your chosen password:
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
  3. Restart MySQL.

I hope this guide helps! If you have any questions, please feel free to contact me@rowles.ch :)