MySQL 5.7.15 installation and configuration method graphic tutorial (windows)

MySQL 5.7.15 installation and configuration method graphic tutorial (windows)

Because I need to install MySQL, I record the installation process as follows. While recording it myself, I hope it will be helpful to those who have questions.

1. Download the software

1. Go to the MySQL official website, log in to your Oracle account (register one if you don’t have one), and download Mysql-5.7.15 from: http://dev.mysql.com/downloads/mysql/

2. Unzip the downloaded file to the specified directory. I unzipped it in D:\mysql-5.7.15-winx64

2. Installation Process

1. First configure the environment variable path and configure D:\mysql-5.7.15-winx64\bin to your own path. The details will not be described in detail again.

2. Copy my-default.ini in the decompression path and change the name to my.ini as shown below

3. Open the file my.ini and add the following content:

[mysqld] 
basedir=D:\\mysql-5.7.15-winx64 
datadir=D:\\mysql-5.7.15-winx64\\data 
port=3306 

sql_mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Where basedir: is the decompression path of the above mysql

datadir: Subsequent initialization and other data will be saved in this directory (Note: Do not create a new data folder in this file directory. My new data folder will be wrong. Follow my steps and it will be automatically created in subsequent operations.)
port: indicates the port for connecting to the database
sql_mode: indicates the sql mode

3. Initialize the database and configure related information

1. Run the Windows command line as an administrator (special reminder: WIN7 and above systems must use administrator identity here, otherwise subsequent operations will go wrong)

2. Enter the mysql decompression directory D:\mysql-5.7.15-winx64\bin (Reminder: You need to enter the bin directory here, otherwise subsequent operations will cause errors)

3. Enter: mysqld --initialize --user=mysql --console, and initialize after execution. At this time, the initial password of root will be generated.

Note the initialization password generated at this time.

4. Register the Mysql service. Run the command: mysqld --install MySQL

If the prompt "Service successfully installed." appears, it proves that the MySQL service is successfully installed.

5. At this point, you can start the mysql service, net start mysql

Users may encounter the following errors:
A system error has occurred 2. The system cannot find the specified file.

Cause of the error: As mentioned above, when running the installation service command: mysqld --install MySQL, we did not enter the bin directory for installation.
Solution: Go to the bin directory, first remove the service, and run the command mysqld --remove
Service successfully removed.
Reinstall the MySQL service, run the command mysqld --install, and then start the MySQL service
D:\mysql-5.7.15-winx64>net start mysql
MySQL service is starting
MySQL service has been started successfully. At this time, the MySQL service has been started successfully.

4. Log in to the database and change the password

In the my.ini file, add skip-grant-tables after [mysqld]
At this point, shut down the mysql service and restart it.
(Enter net stop mysql in the command line to shut down the MySQL service, and enter net start mysql to start the MySQL service)
Login: Enter mysql -u root -p and press Enter. If the password is blank, do not enter it and press Enter to log in to MySQL.

Select mysql database:

Query the user table of the MySQL database, select * from user

At this point, we find that the name of the password field is authentication_string. Some may be passwords, depending on the results of your query.
Perform an update operation on the user table: update user set authentication_string = password("123456") where user="root"

The operation was successful. Exit mysql
Delete skip-grant-tables in the my.ini file and restart the mysql service. Log in to MySQL

Possible subsequent problems:
After installing MySQL and logging in, no matter what command you run, you will always be prompted with this: You must reset your password using ALTER USER statement before executing this statement.

When this problem occurs, you only need to continue running the following two commands in the mysql command line:

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

flush privileges;


Note: The above are 2 commands and need to be executed separately.

After completing the above two commands, MySQL is installed completely.

Reference: MySQL 5.7.14 Installation and Configuration Methods Graphic Tutorial

Wonderful topic sharing: Installation tutorials for different versions of MySQL Installation tutorials for MySQL 5.7 versions Installation tutorials for MySQL 5.6 versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL 5.7.15 installation and configuration method graphic tutorial
  • Tutorial on installing mysql5.7.17 on windows10
  • MySQL 5.7.3.0 installation and configuration graphic tutorial under Windows (installation version)
  • MySQL 5.7.17 installation and configuration method graphic tutorial (windows)
  • MySQL 5.7 installation tutorial (windows)
  • mysql5.7.13.zip installation tutorial (windows)
  • mysql5.7.18.zip Installation-free version configuration tutorial (windows)
  • MySQL 5.7.17 free installation version configuration method graphic tutorial (windows10)
  • MySQL 5.7.17 installation and configuration method graphic tutorial (windows10)
  • mysql5.7.19 winx64 decompressed version installation and configuration tutorial

<<:  Detailed explanation of DOM DIFF algorithm in react application

>>:  Detailed explanation of bash command usage

Recommend

Brief introduction and usage of Table and div

Web front end 1 Student ID Name gender age 01 Zha...

JavaScript Basics: Immediate Execution Function

Table of contents Immediately execute function fo...

Specific usage of Vue's new toy VueUse

Table of contents Preface What is VueUse Easy to ...

Nginx learning how to build a file hotlink protection service example

Preface Everyone knows that many sites now charge...

How to clear the validation prompt in element form validation

Table of contents Problem scenario: Solution: 1. ...

MySQL 8.0 Window Function Introduction and Summary

Preface Before MySQL 8.0, it was quite painful to...

JavaScript BOM Explained

Table of contents 1. BOM Introduction 1. JavaScri...

Specific use of MySQL window functions

Table of contents 1. What is a window function? 1...

Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7

Related reading: MySQL8.0.20 installation tutoria...

A simple example of MySQL joint table query

MySql uses joined table queries, which may be dif...

Solve the problem of Nginx returning 404 after configuring proxy_pass

Table of contents 1. Troubleshooting and locating...

Vue-Router installation process and principle detailed

Table of contents 1. Front-end routing implementa...