2

This tutorial teaches you how to install Mysql on win10 compressed package installer

  • installer is a tool with a graphical interface. After downloading, it is an exe or setup file. Double-click to run the next tool to install software.
  • compressed package is the zip suffix

There is no difference in essence, and there is basically no difference between the content after the installer is installed and the content after the compressed package is decompressed. However, the installer will often help you set environment variables, modify the registry and other tasks. To complete these additional tasks, you need to manually install the compressed package.
Software like Java and Mysql will also provide compressed packages while providing installer. To install Java and Mysql I recommend that you use the compressed package.


experiment platform:

版本    Windows 10 家庭中文版
版本号    20H2
安装日期    ‎2020/‎8/‎16
操作系统内部版本    19042.985
体验    Windows Feature Experience Pack 120.2212.2020.0

Mysql version:

PS C:\Users\17293> mysql --version
C:\Program Files\MySQL\bin\mysql.exe  Ver 8.0.21 for Win64 on x86_64 (MySQL Community Server - GPL)

The original intention of writing this article is because when win10 is installed on Mysql , administrator mode of powershell cannot log in to Mysql . Direct mysql does not work, mysql -u root does not work, mysql -u root -p then enters the mysqld --initialize the initial password generated is incorrect. Error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) , too annoying!!!!!
As a result, the wrong input mysql -u root -p"_<AsDttMd1o2" just fine

_<AsDttMd1o2 is the initial password generated by mysqld --initialize

Download Mysql

Download address https://dev.mysql.com/downloads/mysql/

Download Windows (x86, 64-bit), ZIP Archive , which is the smaller one

image.png

unzip

After decompression, place it in the following path in the C drive:
C:\Program Files\Mysql

image.png

In Program Files folder create a file Mysql folder, unzip the file into the folder Shear Mysql folder
Don't put it on the D drive or E drive. It's 2021. Get rid of the bad habit of not installing the software on the C drive.

Add environment variables

C:\Program Files\Mysql\mysql-8.0.21-winx64\bin to the environment variable

Pay attention to mysql-8.0.21-winx64 your own version

Add service

mysqld install

After adding environment variables, you need a relative path or an absolute path to call mysqld

Note that it is mysqld, not mysql, because mysql is a client program and mysqld is a server program

Configuration

Some tutorials will teach you to configure my.ini , this file is not necessary, so I won’t talk about it here

> cd "C:\Program Files\Mysql\mysql-8.0.21-winx64"

> mysqld.exe --initialize --console
2021-05-15T03:14:48.650104Z 0 [System] [MY-013169] [Server] C:\Program Files\Mysql\mysql-8.0.21-winx64\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 6040
2021-05-15T03:14:48.689134Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-15T03:14:49.796361Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-05-15T03:14:51.118883Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: _<AsDttMd1o2


> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

> mysql -u root -p"_<AsDttMd1o2"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21

Copyright (c) 2000, 2020, 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.

mysql>
Pay attention to mysql-8.0.21-winx64 your own version

There are places that are easy to step on in the appeal operation

  • mysqld --initialize --console in --console indispensable, otherwise it will be very troublesome
  • It’s best to enter the password directly after -p , and display the addition, do not quotation marks, this is very important.

Common errors

  • ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Solution: It is best to enter the password directly after -p , and display the addition. Do not quotation marks, which is very important.


universe_king
3.4k 声望678 粉丝