MySQL 8.0 installation-free version configuration method

For different operating systems, MySQL provides corresponding versions. Under the Windows operating system, the installation package of the MySQL database is divided into two types: GUI installation and installation-free installation. The installation methods of these two installation packages are different, and the configuration methods are also different. The GUI installation package has a complete installation wizard, which is very convenient for installation and configuration. The installation-free installation package can be directly decompressed and used, but it is inconvenient to configure. The article mainly introduces the configuration method of mysql 8.0.26 installation-free version for you in detail

1. Download the MySQL archive

Official download address: https://dev.mysql.com/downloads/mysql/
insert image description here

2. Unzip it to the location you want to install

insert image description here

3. Create the my.ini configuration file and move it to the directory to be installed

insert image description here

4. Open the my.ini file to edit the configuration information

Reference configuration:

[mysql]
#设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port =3306
#设置安装目录
basedir=E:\MySQL\mysql-8.0.26-winx64
#设置数据存放目录
datadir=E:\MySQL\mysql-8.0.26-winx64\data
#允许最大连接数
max_connections=200
#创建新表时将使用带默认存贮引擎
default-storage-engine=INNODB

Close the my.ini file after saving

5. Initialize the database and install and log in to the database

1). First enter the bin directory, open the command prompt (cmd) as an administrator, and initialize the database

mysqld --initialize --console

As shown in the picture :
![Insert picture description here](https://img-blog.csdnimg.cn/c8de99df28d94b2b831d3d41af0d24d6.png insert image description here
Remember the password generated in the picture, which is a randomly generated initial password.

2). Install the database

mysql --install

insert image description here

At this point, there will be an additional data folder in the directory
insert image description here
3). Start the database and log in with the initial password

//启动
net start mysql

As shown in the figure:
insert image description here
4). Modify the password to complete the installation

Use SQL statement to modify, for example, change the password to abcd

ALTER USER 'root'@'localhost' IDENTIFIED BY 'abcd';

Exit after modification is complete:

exit;

Then log in again and test whether the installation is successful.

Guess you like

Origin blog.csdn.net/weixin_46220576/article/details/123152235