Solve the problems encountered when installing mysql-8.0.11-winx64 in Windows environment

Solve the problems encountered when installing mysql-8.0.11-winx64 in Windows environment

Download the MySQL installation package. I downloaded mysql-8.0.11-winx64, unzip it to the directory you want to install it, and then configure the environment (under Windows environment, I haven't tried it on Mac yet).

1. First, configure the environment: right-click this computer -> Properties -> Advanced system settings -> Environment variables -> path -> New, and then add your own path (for example, my directory: F:\mysql\mysql-8.0.11-winx64). In addition, you need to see if there is a my.ini file or my-default.ini file in the unzipped compressed package. If not, you need to write one in the root directory. The default configuration information is as follows:

To view all configuration items, refer to: https://dev.mysql.com/doc/refman/8.0/en/mysqld-option-tables.html

[mysqld]
# Set port 3306 port=3306
# Set the installation directory of mysql to basedir=F:\mysql\mysql-8.0.11-winx64
# Set the storage directory for the MySQL database data (this directory will be generated by commands later, no need to write it manually)
datadir=F:\mysql\mysql-8.0.11-winx64\Data
# Maximum number of connections allowed max_connections=200
# The number of connection failures allowed. This is to prevent someone from trying to attack the database system from this host max_connect_errors = 10
# The default character set used by the server is UTF8
character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB
# By default, the "mysql_native_password" plug-in is used for authentication. default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set of the mysql client to default-character-set=utf8
[client]
# Set the default port used by the mysql client to connect to the server port = 3306
default-character-set=utf8

2. Then open the terminal, press window+r and enter cmd to open the terminal and switch to the path, and execute the command mysqld --initialize to check the current environment. If there is no error, open your directory and you will see a data folder in your root directory; everything is normal

Note that you may encounter some error messages in this step, such as "Cannot continue code execution because vcruntime140.dll is not found. Reinstalling the program may solve this problem." This means that your computer is missing some necessary files. At this time, you need to open the control panel to view the specific information of C++ 2015.

My problem is that I didn't have x64-bit C++ before, so the file is missing. If you have it, you can click Uninstall. It will prompt you to repair it. Click Repair. After it's done, you can continue to enter commands in the terminal.

Initialize the database

mysqld --initialize --console

At this time, the following error will be printed, which means that there is already a data directory. Just delete it.

F:\mysql\mysql-8.0.11-winx64\bin>mysqld --initialize --console
2018-10-29T09:26:35.244245Z 0 [System] [MY-013169] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 980
2018-10-29T09:26:35.287469Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2018-10-29T09:26:35.299110Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-10-29T09:26:35.302159Z 0 [System] [MY-010910] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.11) MySQL Community Server - GPL.

Execute the above command again, and the user's initial password will be printed. @localhost:XXXXXX is the default password. You need to remember it. If you don't remember it, delete the data file generated later and generate it again.

F:\mysql\mysql-8.0.11-winx64\bin>mysqld --initialize --console
2018-10-29T09:28:49.177043Z 0 [System] [MY-013169] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 12980
2018-10-29T09:29:19.270535Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: kw3AlnY_g.Dg
2018-10-29T09:29:41.684599Z 0 [System] [MY-013170] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed

3. Then install the service, mysqld --install [service name]. If there is only one service, you can leave the default mysql blank. If there are multiple services, you can write the specific service name, XXXX. After pressing Enter, an error occurs again, install/remove of the service deined. This is because the cmd is not run as an administrator. Just run cmd again as an administrator. If service successfully installed appears, it means the service is installed.

F:\mysql\mysql-8.0.11-winx64\bin>mysqld --install
Service successfully installed.

4. Start the service and run the command: net start mysql. You can see that the service has been started successfully.

F:\mysql\mysql-8.0.11-winx64\bin>net start mysql
MySQL service is starting....
The MySQL service has been started successfully.

5. Change password and password authentication plug-in,

Execute the command in the bin directory of the MySQL installation directory: mysql -u root -p

F:\mysql\mysql-8.0.11-winx64\bin>mysql -u root -p
Enter password: *******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

At this time, you need to regenerate the password, delete the data directory, and run mysqld --initialize --console.

F:\mysql\mysql-8.0.11-winx64\bin>mysqld --initialize --console
2018-10-29T10:04:23.337650Z 0 [System] [MY-013169] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 7928
2018-10-29T10:05:19.210237Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: RXZG!fJR2Ly+
2018-10-29T10:06:00.603070Z 0 [System] [MY-013170] [Server] F:\mysql\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed

Re-execute mysql -u root -p and enter the password (note that there are no spaces around the password). The relevant information will be printed out.

F:\mysql\mysql-8.0.11-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

To change the user password, execute the command in MySQL: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new password';. If the following situation appears, it proves that you have successfully changed the password.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '5502yulijian.';
Query OK, 0 rows affected (0.17 sec)

show databases; (';' must be added)


That's it.

Summarize

The above is what I introduced to you about solving the problems encountered in installing mysql-8.0.11-winx64 in Windows environment. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • MySQL 8.0.20 installation tutorial and detailed tutorial on installation issues
  • MySQL 8.0.19 winx64 installation tutorial and change the initial password under Windows 10
  • Tutorial on installing mysql-8.0.18-winx64 under Windows (with pictures and text)
  • Installation method of mysql-8.0.17-winx64 under windows 10
  • mysql8.0 windows x64 zip package installation and configuration tutorial
  • MySQL 8.0.20 Installation Tutorial with Pictures and Text (Windows 64-bit)

<<:  JavaScript implements asynchronous submission of form data

>>:  In-depth explanation of Session and Cookie in Tomcat

Recommend

Solution to forgetting MySQL root password in MACOS

MySQL is a relational database management system ...

Native JS to implement login box email prompt

This article shares a native JS implementation of...

Three useful codes to make visitors remember your website

Three useful codes to help visitors remember your...

How to debug loader plugin in webpack project

Recently, when I was learning how to use webpack,...

How to set mysql5.7 encoding set to utf8mb4

I recently encountered a problem. The emoticons o...

Simple implementation of Mysql add, delete, modify and query statements

Simple implementation of Mysql add, delete, modif...

MySQL 5.7.17 installation and configuration tutorial for Mac

1. Download MySQL Click on the official website d...

Learn how to use the supervisor watchdog in 3 minutes

Software and hardware environment centos7.6.1810 ...

JS implements click drop effect

js realizes the special effect of clicking and dr...

In-depth study of vue2.x--Explanation of the h function

Table of contents Solution, Summarize: vue projec...

Implementation of Docker deployment of MySQL cluster

Disadvantages of single-node database Large-scale...

Build a server virtual machine in VMware Workstation Pro (graphic tutorial)

The VMware Workstation Pro version I use is: 1. F...

Docker primary network port mapping configuration

Port Mapping Before the Docker container is start...

Detailed description of the use of advanced configuration of Firewalld in Linux

IP masquerading and port forwarding Firewalld sup...