MySQL on the installation process of the zip installation package

1. Download the zip installation package

1. MySQL official website download address: MySQL :: MySQL Community Downloads

2. Download directly or choose other versions to download.

2. Unzip to a custom installation directory

3. (Skipping) Configure environment variables

4. Create and configure the my.ini file (to be created in the directory just after decompression)

In the newer version, there is no my.ini file in the downloaded zip, you need to create a new my.ini yourself. (my.ini is some configuration of MySQL, such as port, number of connections, etc., which should be placed in the root directory of mysql)

The content of my.ini is as follows, remember to modify basedir and datadir :

1. The basedir should contain the decompressed folder (such as mysql-8.0.29-winx64).

2. In MySQL, utf8mb4 is what we usually call UTF-8 encoding!

      Utf8 can be regarded as a compromise version of the encoding, utf8 is only 3 bytes at most, you can learn this by yourself!

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\MySQL\mysql-8.0.29-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\MySQL Datas

# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为UTF8
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

 5. Initialize and install MySQL

(1) Create a new data folder under the installation directory mysql-8.0.29-winx64

(2) Run the cmd command as an administrator, and switch to the bin under the installation directory (such as mysql-8.0.29-winx64\bin)

(3) Initialize MySQL (in cmd, under the bin of the installation directory)

mysqld --initialize --console

If an error is reported after execution: this program cannot be started because VCRUNTIME140_1.dll is missing from the computer, try to reinstall this program to solve this problem , and the specific solution is at the end of this article!

After execution, write down the initialization password after A temporary password is generated for root@localhost:.

(4) Install MySQL (in cmd, under the bin of the installation directory; permission is required here, so the cmd run by the administrator should be used in front)

mysqld --install

When Service successfully install appears, it means your installation is successful.

(5) Log in to the database (in cmd, under the bin of the installation directory: because you may not have configured environment variables before, hahaha. You can often use the cmd command to configure it)

mysql -u root -p

Password use the initial password you recorded above.

(6) Modify the password of the database

ALTER USER root@localhost IDENTIFIED BY '123456';

6. (Can be ignored) the installation is complete

Well, the MySQL installation has been completed normally here.

If you encounter other problems, you can search for solutions by yourself.

Record the problems you encountered during installation, you can refer to the following:

Supplement: Other problems that may be encountered during the installation process

1. An error is reported when installing MySQL: this program cannot be started because vcruntime140_1.dll is missing from the computer

You can refer to my blog: Install MySQL error: vcruntime140_1.dll is missing from the computer

2、Can't connect to MySQL server on 'localhost:3306'

Solution: This is because the MySQL service is not started, just start the MySQL service!

Guess you like

Origin blog.csdn.net/qq_37738899/article/details/125608627