Mysql download
Download mysql community server from the official website
https://dev.mysql.com/downloads/mysql/
. You can choose to download the compressed package or MSI installer.
Install using compressed package
MySQL compressed package installation usually requires the following steps:
1. Download the MySQL installation package
You can download the MySQL installation package suitable for your system from the MySQL official website, and select the appropriate version to download.
Download mysql8.0 or above version here
Unzip: Unzip the downloaded MySQL installation package to the target path, which contains the following files
2. Configure environment variables: add the bin folder path under the mysql folder to the system variable Path
Note that there are many paths in path. Add them at the end. Do not delete the previous ones, otherwise it will cause a series of consequences such as system crash. If there is an edit box in the form of a list, just create a new line and add it. There is no need to consider other issues. If it is directly To edit text,
;
separate multiple paths with;
3. Configure the initialization configuration file my.ini
: create my.ini in the root directory of the mysql folder (modify it directly if it exists)
The configuration content of my.ini is as follows, which should be modified according to the actual installation situation.
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\mysql-8.0.23-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql-8.0.23-winx64\Data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数
max_connect_errors=10
# 服务端使用的字符集
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
4. Install mysql service
Right-click the start menu and select command line or powershell (administrator). How to open powershell and enter cmd to switch to the command line?
mysqld --initialize --console
Don’t close the window after running it
mysqld --install [服务名]
Start service
net start mysql
Log in to mysql
and enter the following command to log in, and then enter the password. Here you need to use the password in the above initialization.
mysql -u root -p
change Password
Enter the following command. xxxx is the new password to be changed. It must be added at the end
;
, otherwise the command will not be executed.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxx';
result:
Query OK, 0 rows affected (0.01 sec)
Install using the installation package MSI
Using msi to install mysql simplifies some installation steps and is suitable for novices
Download the installation package from the official website
Install
Select setting type
Typical typical installation: install the most common program functions. Recommended for most users.
Custom installation (according to personal needs): allows users to choose which program functions will be installed and where to install them. It is recommended for advanced users.
Complete installation: All program features will be installed and require the most disk space.
Select Custom installation, you can modify the installation path, if not needed, select typical
Click OK for typical installation, and the installation will be completed automatically. After the installation is completed, select Run MYSQL Configuration
Configuration
When the installation is complete, you will be prompted to enter the configuration interface.
Set the network configuration and select the default port 3306
Enter the password for the administrator account root (compared to compressed package installation, it eliminates the need to find the initialization password and then change the password)
windows service
Select the default configuration and change the service name
Follow the default configuration
ClickExecute
After completion, next, then finish.
test
After the configuration is completed, use the tool to connect. Here, use navicat to test the link. If the connection is successful, it means the installation and configuration are correct.