The installation of MySQL and the solution to the problem of ERROR 1045 (28000)

Introduction to the MYSQL folder


The executable file is placed in the bin directory. Docs
stores
documents.
Include
contains header files.
lib
stores library files.
share
stores language and character set related information.
COPYING
stores copyright information
README
open source protocol information

mysql download

[Step 1] MySQL is divided into installation version and decompression version. The decompression version is downloaded here. The download address is
https://downloads.mysql.com/archives/community/Because
the latest version is not stable, so choose 5.7.24 here Version, choose 32-bit or 64-bit according to your computer configuration, here I choose Windows (x86, 64-bit), ZIP Archive click Download
insert image description here

MYSQL environment variable settings

[Step 2]
①Search for the environment variable in the computer input box, then compile the environment variable, and fill in the variable value with the directory decompressed from the installation package just downloaded on your computer ②Set the following content
insert image description herein Path
insert image description here
to complete the environment variable settings

Configuration file my.ini

[Step 3] Create a configuration file in the directory where mysql is located, create a text file and modify .txt to .ini. Open with notepad, enter
the following code, and save

[mysql]
default-character-set=utf8

[mysqld]
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Initialize MySQL

[Step 4] Run the command prompt as an administratorinsert image description here

① Type in the command line mysqld --initialize-insecure, press Enter, and wait for a while. If there is no error message (as shown in the figure below), it proves that there is no problem with the initialization of the data directory. At this time, check that the data directory has been generated under the MySQL directory.

mysqld --initialize-insecure

insert image description here

②Knock in the black box mysqld -installand press Enter.

mysqld -install

insert image description here
③Knock in the black box net start mysqland press Enter.

net start mysql  // 启动mysql服务
    
net stop mysql  // 停止mysql服务

insert image description here

Type in the black box mysqladmin -u root password 1234, here 1234refers to the password of the default administrator (that is, the root account), you can modify it to your liking.

mysqladmin -u root password 1234

insert image description here

So far, the MySQL 5.7 decompressed version has been installed!

Login to MySQL

Right-click the start menu, select 命令提示符, open the black box.
Enter in the black box, mysql -uroot -p1234and press Enter, the following figure appears and the lower left corner is mysql>, then the login is successful.

mysql -uroot -p1234

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-XyEhXp7E-1646636096379)(.\imgs\1556823-20181220222422178-61579658.png)]

Mysql cannot log in after entering the correct password, and ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: yes) appears

But I am correct in every step, and I still make mistakes. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: yes) I have studied this problem for a long time and know that mysql input is correct after reading this
blog
. The password cannot be logged in, and ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: yes) appears

MySQL uninstall

If you want to uninstall MySQL, it's easy too.

Right-click the start menu, select 命令提示符(管理员), open the black box.

  1. Type net stop mysqland enter.
net stop mysql

  1. Type again mysqld -remove mysqland press Enter.
mysqld -remove mysql

insert image description here

  1. Finally, delete the MySQL directory and related environment variables.

At this point, MySQL uninstallation is complete!

Guess you like

Origin blog.csdn.net/weixin_46362658/article/details/123318816