Install MySQL5.7.18 for Windows 10 and mysql for mysql

Source: Internet
Author: User
Tags windows x86

Install MySQL5.7.18 for Windows 10 and mysql for mysql

Install MySQL5.7.18 for Windows 10

Because it is installed and written, and MySQL5.7 and later installation are quite painful, there may be many Xuanxue errors that may cause the installation to fail. Please advise.

Installation environment and software version

Windows: Windows 10 x64 Chinese edition

MySQL: Microsoft Windows x86, 64-bit zip archive

Installation Process 1. Download the Installation File

Simply put: log onto the official website ( => Downloads => Community => MySQL Community Server => Microsoft Windows & Windows (x86, 64-bit) => ZIP Archive & Download => No thanks, just start my download.

Then the download process starts.

2. Start Installation

According to official documents:

2.3.5 Installing MySQL on Microsoft Windows Using a noinstall Zip Archive Extracting the Install Archive2.3.5.2 Creating an Option File2.3.5.3 Selecting a MySQL Server Type2.3.5.4 Initializing the Data Directory2.3.5.5 Starting the Server for the First Time2.3.5.6 Starting MySQL from the Windows Command Line2.3.5.7 Customizing the PATH for MySQL Tools2.3.5.8 Starting MySQL as a Windows Service2.3.5.9 Testing The MySQL Installation

Users who are installing from the noinstall package can use the instructions in this section to manually install MySQL. The process for installing MySQL from a Zip archive is as follows:

Extract the main archive to the desired install directory

Optional: also extract the debug-test archive if you plan to execute the MySQL benchmark and test suite

Create an option file

Choose a MySQL server type

Initialize MySQL

Start the MySQL server

Secure the default user accounts

This process is described in the sections that follow.

The steps are as follows:

These steps. It looks quite simple, but I am still panic considering the installation of MySQL.

Then, install it step by step according to the document.

1. Create an installation directory and decompress the downloaded installation file to the directory.

And decompress the package.

By the way, pay attention to the following points in the document: Extracting the Install Archive

To install MySQL manually, do the following:

If you are upgrading from a previous version please refer to Section 2.3.8, “Upgrading MySQL on Windows”, before beginning the upgrade process.

Make sure that you are logged in as a user with administrator privileges.

Choose an installation location. Traditionally, the MySQL server is installed in C:\mysql. The MySQL Installation Wizard installs MySQL under C:\Program Files\MySQL. If you do not install MySQL at C:\mysql, you must specify the path to the install directory during startup or in an option file. See Section, “Creating an Option File”.


The MySQL Installer installs MySQL under C:\Program Files\MySQL.

Extract the install archive to the chosen installation location using your preferred Zip archive tool. Some tools may extract the archive to a folder within your chosen installation location. If this occurs, you can move the contents of the subfolder into the chosen installation location.

Note the following:

I don't know how to confirm the 1st items. Let's take a step. There are 2nd compression tools. In short, thank you for telling me.

The decompressed result is as follows. Let's move the content in the document to the previous directory,

Start the next step.

2. Create a configuration file

According to the document content:

When the MySQL server starts on Windows, it looks for option files in several locations, such as the Windows directory, C:\, and the MySQL installation directory (for the full list of locations, see Section 5.2.6, “Using Option Files”). The Windows directory typically is named something like C:\WINDOWS. You can determine its exact location from the value of the WINDIR environment variable using the following command:

C:\> echo %WINDIR%

MySQL looks for options in each location first in the my.ini file, and then in the my.cnf file. However, to avoid confusion, it is best if you use only one file. If your PC uses a boot loader where C: is not the boot drive, your only option is to use the my.ini file. Whichever option file you use, it must be a plain text file.

It seems that the configuration file my. ini must be placed in the system directory. If you do not know the directory location, you can use echo % WINDIR % to obtain it.

We can see that C: \ Windows is the Windows Directory. However, this directory contains many and complex files, most of which are important to the system and have access control for this file. I am worried that the program will fail to be started due to permission reasons. For these reasons, it is better not to put the configuration file into the system directory.

Can it be placed in another path? Let me refer to the document.

On Windows, MySQL programs read startup options from the files shown in the following table, in the specified order (top files are read first, files read later take precedence).

Table 5.1 Option Files Read on Windows Systems

File Name Purpose

%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini, %PROGRAMDATA%\MySQL\MySQL Server 5.7\my.cnf Global options

%WINDIR%\my.ini, %WINDIR%\my.cnf Global options

C:\my.ini, C:\my.cnf Global options

BASEDIR\my.ini, BASEDIR\my.cnf Global options

defaults-extra-file The file specified with --defaults-extra-file, if any

%APPDATA%\MySQL\.mylogin.cnf Login path options (clients only)

In the preceding table, %PROGRAMDATA% represents the file system directory that contains application data for all users on the host. This path defaults to C:\ProgramData on Microsoft Windows Vista and greater, and C:\Documents and Settings\All Users\Application Data on older versions of Microsoft Windows.

%WINDIR% represents the location of your Windows directory. This is commonly C:\WINDOWS. Use the following command to determine its exact location from the value of the WINDIR environment variable:

C:\> echo %WINDIR%

%APPDATA% represents the value of the Windows application data directory. Use the following command to determine its exact location from the value of the APPDATA environment variable:

C:\> echo %APPDATA%

BASEDIR represents the MySQL base installation directory. When MySQL 5.7 has been installed using MySQL Installer, this is typically C:\PROGRAMDIR\MySQL\MySQL 5.7 Server where PROGRAMDIR represents the programs directory (usually Program Files on English-language versions of Windows), See Section 2.3.3, “MySQL Installer for Windows”.

In document 5.2.6 Using Option Files, there is a configuration file reading sequence. I don't know what the first one is, but we can see that the second one is the installation directory. Although the priority is not high, files with the same name in other directories will take effect.

Create a configuration file in the installation directory:

Note that the file encoding format is preferably UTF-8 without BOM. The content is as follows:


It should be enough if it is started.

3. Select MySQL service type

In fact, I don't know what the MySQL service type refers. The root cause is literal translation based on the Selecting a MySQL Server Type document title. Step by step.

I have read the document and it seems that this step is just a science exercise, so I don't need to do anything. Let's start the next step.

4. initialize the database directory file

This step is very important. I believe that you should be familiar with Linux or Unix compiling and installing MySQL. In general, this step is used to generate database data files. Initializing the Data Directory

If you installed MySQL using the Noinstall package, you may need to initialize the data directory:

Windows distributions prior to MySQL 5.7.7 include a data directory with a set of preinitialized accounts in the mysql database.

As of 5.7.7, Windows installation operations performed using the Noinstall package do not include a data directory. To initialize the data directory, use the instructions at Section, “Initializing the Data Directory Manually Using mysqld”.

As described in this document, Windows releases earlier than 5.7.7 contain pre-initialized database files, but later versions require manual initialization. Really annoying.

According to the document Initializing the Data Directory Manually Using mysqld, the proposed steps are as follows:

Then, just wait... it should be okay. Process

Oh, right. The details are missing. Create a database folder and specify it in the configuration file.

I created it in the installation directory,

It was originally an empty directory. After initialization, there was a file in it,

This step should be successful.

5. Start the service for the first time

According to the document, execute mysqld.exe -- console. Of course, it must be in the installation directory.

The document should look like this:

To start the server, enter this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" --console

For a server that includes InnoDB support, you should see the messages similar to those following as it starts (the path names and sizes may differ):

InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:InnoDB: a new database to be created!InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200InnoDB: Database physically writes the file full: wait...InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer createdInnoDB: creating foreign key constraint system tablesInnoDB: foreign key constraint system tables created011024 10:58:25  InnoDB: Started

When the server finishes its startup sequence, you should see something like this, which indicates that the server is ready to service client connections:

mysqld: ready for connectionsVersion: '5.7.19'  socket: ''  port: 3306

The server continues to write to the console any further diagnostic output it produces. You can open a new console window in which to run client programs.

However, here I am like this:

I don't know if this is... but I'm optimistic that it's successful. Next, next.

6. Start MySQL through the command line

The procedure is as follows:

Because of the initialization parameter relationship, the root account does not have a password. Process

This step is OK.

As for the Xuanxue error in step 1, I am too lazy to check the document. If any reader knows this, I am very grateful.

Conclusion 1. Methods for starting and disabling services

Start is to execute mysqld.exe -- defaults-file = D: \ webserver \ mysql-5.7.18 \ my. ini in the bin directory of the installation directory, to close it, you need to execute mysqladmin-u root shutdown.

2. Configuration File

My configuration file has only four lines, which is definitely not enough, but it is okay if it is simple to use. In short, it is not extended here. Let's talk about it later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.