List of problems when installing MySQL5.7.43 on win11

1. Check if mysql is installed on your computer in win11

Method 1

win+R:
Insert image description here
Check if there is a mysql service
Insert image description here

Method 2

Insert image description here

2. Completely clear the previously installed mysql

  1. Stop mysql service

  2. Uninstall residuals.
    Under the control panel, uninstall all MySQL files.
    Insert image description here

  3. Delete the MySQL folder
    Files (x86)\MySQL. Right click on the folder and select "Delete"

  4. Delete the MySQL registry key
    win+R: Enter "regedit" to open the registry editor. In the editor, find the following path "HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB", right-click and select "Delete".
    Insert image description here

  5. Clean your computer
    Finally, run Disk Cleanup and Disk Defragmentation programs to make sure all MySQL residual files have been removed.

  6. Restart the computer

3. Mysql installation

There are two ways to download MySQL, one is in msi format, and the other is our current zip format. You can download it after decompressing it.

Method 1

Official website address: https://downloads.mysql.com/archives/installer/Choose
this
Insert image description here

My win11 has no response when opening msi

Using the following method, although the operation is successful, the downloaded msi still cannot be opened by double-clicking it.
Insert image description here

Method 2

Official website: https://www.mysql.com/

  1. Download the zip package
    and find it in the download module.
    Insert image description here
    Then , if
    Insert image description here
    you
    Insert image description here
    don’t have an account or do not need to register, you can directly select "No thanks, just start my download." at the bottom for direct download.
    Insert image description here

  2. Unzip it to a path. Mine is in D:\Download\mysql-5.7.43-winx64
    . Even if it is installed,
    Insert image description here
    Insert image description here
    create a new text document in the folder above and save the document as the "my.ini" configuration file.
    The red box needs to be replaced with your own decompression path.
    Insert image description here

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\Download\mysql-5.7.43-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\Download\mysql-5.7.43-winx64\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

Set system environment variables: Settings-System-About-Advanced system settings-Environment variables

Add D:\Download\mysql-5.7.43-winx64\bin to the user variable Path

Insert image description here

  1. Find the bin file in the decompression path. My decompression path is D:\Download\mysql-5.7.43-winx64\bin.
    Open cmd as an administrator, enter the following commands in sequence, and be sure to switch to the decompression path.

Other bloggers’ steps

# 切换到bin目录:
cd D:\Download\mysql-5.7.43-winx64\bin
mysqld --initialize --console  (会出现随机密码,例如我的随机密码:FYdj_iZew5lx)

# 安装mysql服务:
mysqld --install MySQL

# 启动MySQL服务:
net start MySQL

# 登录mysql:
mysql -u root -p  (password后面手动输入上面的随机密码)

# 修改登录密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; (这里将登录密码修改位:123456)

#退出mysql:
exit或者quit。

What I did during my own installation

The difference is that when I installed mysql, the name was root

mysqld --initialize --console

Insert image description here
Get the password: FYdj_iZew5lx

Then enter

mysqld --install root

Insert image description here

Next enter

net start root

Insert image description here

Last input

mysql -u root -p #登录启动

Insert image description here
Check it in the service. Since the name I use is root,
Insert image description here

4. Some problems encountered

1) 'mysql' is not recognized as an internal or external command, operable program or batch file

  • Find the computer's environment variables and check if there is mysql in the path set by the system.
  • Just copy and paste the bin directory in your MySQL installation path into it. Note that the picture above shows the location of my installation directory. (You can find it in the properties of the corresponding application in the service)

2) Forgot mysql password

mysql admin -u root password
mysql -u root -p   # 登录mysql,会让输入密码

my.ini configuration file in the install path. In this configuration file, we need to enter the MySQL service password in the following format:Insert image description here

3) MySQL cannot be started: The MySQL service on the local computer stops after starting.

Navicat suddenly and inexplicably cannot connect to the mysql
Insert image description here
viewing service and cannot start it. An error occurs when starting it manually:
Insert image description here

  • The first step is to back up the data

Enter the MySQL installation directory, copy a data file, which contains your database tables and a lot of other information, such as account and password.
Then clear the data folder.

  • Step two.
mysqld --initialize

In the bin directory, enter mysqld --initialize on the command line
and wait for a while.

At this time, the things in the data that were just cleared are back.

  • Step 3. Try to run
 net start root 

I remember my service name is root

Insert image description here

4) Navigate connection, Access denied for user 'root'@'localhost' (using password: YES) appears when logging in to MySQL.

Access denied for user 'root'@'localhost' (using password: YES) appears when logging in to MySQL. Access is denied and the MySQL password can be modified. There
Insert image description here
are two places to analyze:

Access denied; (denied access)
using password: YES/NO

Solution:
In the configuration file, add the following code to bypass password verification:

skip-grant-tables

Insert image description here

Guess you like

Origin blog.csdn.net/wang13679201813/article/details/131816305