Install MySQL Server 8.0.27 [zip Archive] on Windows 10

In this article, you will see how do you install MySQL server 8.0.27 on the Windows 10 operating system using a zip archive file.

Software Dependency

  • MySQL Server 8.0.27 [zip]
  • Windows 10

How do we install MySQL server on Windows 10(64-bit)?

Steps to install MySql server on windows 10 64-bit operating system:

  1. Download MySql zip Archive file
  2. Extract the Zip Archive File
  3. Configure system environment variables
  4. Initialize the data directory and database
  5. Start MySQL Service and Connect to the Server

Download MySQL zip Archive file

First, we have to download the zip archive file from its official website download page. On the download page, select the operating system as Microsoft Windows and choose Windows (x86, 64-bit), ZIP Archive, then click on the download button as you can see in the below image.

Download MySQL zip Archive file

Once you click on the download button, it will open the below page. Here, you just need to click on the link No thanks, just start my download to start downloading.

Download MySQL zip Archive file

Extract the Zip Archive File

Once you download the zip archive, you have to extract it at the desired location. In this article, we have extracted it at C:\MySQL\mysql-8.0.27-winx64

Extract the Zip Archive File

Create MySQL configuration file

The configuration file is used to initiate the MySQL database server. Create a new my.ini file and a data Folder inside the base directory.

Base directory: C:/MySQL/mysql-8.0.27-winx64

Now, put the following content in the my.ini document. You can use a plain text editor(eg. notepad or notepad++) to create this file.

[mysqld]
# set basedir to your installation path
basedir="C:/MySQL/mysql-8.0.27-winx64"
# set datadir to the location of your data directory
datadir="C:/MySQL/mysql-8.0.27-winx64/data"
# Set up port
port=3306
# Maximum connections allowed
max_connections=200
# Number of connection failures allowed .
max_connect_errors=10
# The character set used by the server defaults to UTF8
character-set-server=utf8
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB

[mysql]
# Set up mysql Client default character set
default-character-set=utf8

[client]
# Set up mysql The default port when the client connects to the server
port=3306
default-character-set=utf8

Configure system environment variables

System Environment Variables path:

Right click on MyComputer -> properties -> Advanced System Settings -> Environment variables
system environment variables

Now, click on the Environment Variables button > add MYSQL_HOME & Path variables with the following value:

Variable nameVariable value
MYSQL_HOME C:/MySQL/mysql-8.0.27-winx64
Path%MYSQL_HOME%\bin

Initialize the data directory and database

The ZIP archive of MySQL does not include the data directory; therefore, we must initialize it manually. When we initialize MySQL, it creates the MySQL system database files and system tables in the specified data directory.

Data directory: C:/MySQL/mysql-8.0.27-winx64/data

To initialize MySQL and create a MySQL database, we must run the mysqld command with the –initialize or –initialize-insecure option. The meaning of using these options are as follow:

–initializeThis option is considered secure by default. In this case, MySQL generates a random root password. Once installation completes, the root password will be expired, and you must create a new root password.
–initialize-insecureIn this option, we do not need to specify the root password. It is considered that the user will create the root password before moving on to production.

Here, we will use the –initialize option to initialize it.

Now, open the command prompt as an administrator user. Jump to the C:/MySQL/mysql-8.0.27-winx64/bin directory, and run the following command:

C:\MySQL\mysql-8.0.27-winx64\bin>mysqld --initialize
Initialize the data directory using command prompt

The above command will take a few minutes to initialize the MySQL database. To verify the successful initialization, open the data directory(C:/MySQL/mysql-8.0.27-winx64/data). You can see the data directories and system database files have been created, which indicates that the initialization was completed successfully.

During the initialization process, MySQL writes the logs in the data directory of MySQL. You can use it to review them or diagnose any issue. The file name format of the error log is [Host Name].err. In this file, we can see our randomly created password for the user root as follow:

A temporary password is generated for root@localhost: k_?W)BxTo3q2

NOTE:

If you got any .dll file missing error while initializing mysql, then visit the https://www.dll-files.com/ to download and paste it at location C:\Windows\System32 in your computer.

Start MySQL Service and Connect to the Server

To start the MySQL service, run the following command:

C:\MySQL\mysql-8.0.27-winx64\bin>mysqld
start mysql service using command prompt

Now the service has been started successfully. Don’t close this command prompt window until you want to stop it.

Now, connect to the MySQL server using mysql command-line tools. Start another session of command prompt and run the following command. Provide the randomly created password here,

mysql -u root -p
connect mysql server using command prompt

You are now connected to the MySQL server.

If you want to change the password for the root user, do it as follow:

mysql> ALTER USER root@localhost IDENTIFIED  BY '123456';

Conclusion

In this article, you have seen the installation process step by step using the zip archive file. It is completely different from the installation process of MySQL using MSI installer. The installer is a GUI tool that makes the installation process much easier than the MySQL zip archive installation process.

Related articles:

Share with friends

Leave a Comment

Your email address will not be published. Required fields are marked *