Mysql has a compressed version and an msi version. After the compressed version is downloaded, it is installed and uncompressed, but it needs to be configured before it can be used. The following describes the installation and configuration method of the Mysql compressed version of the Windows system.
1. First go to the Mysql official website to download the compressed version, address: https://dev.mysql.com/downloads/mysql/
2. After opening the website, find this place to download.
3. Go to this page after clicking Download, click directly to download at the bottom left.
4. After downloading, find a path to unzip.
5. Then configure the environment variables (right-click on this computer, properties, advanced system settings, environment variables, create a new system variable, the variable name is: MY_HOME , the value is mysql path )
OK, then find the Path variable in the system variable , edit, create: % MYSQL_HOME% \ bin
In this way, even if the configuration is complete.
6. Then you need to create a configuration file my.ini in the decompression path (create a new text box with the name my and the suffix named ini), then edit and enter the following code and save it.
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置mysql的端口口号
port = 3306
# 设置mysql的安装目录
basedir=D:\mysql\mysql-5.6.33-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql\mysql-5.6.33-winx64\data
# 允许最大连接数
max_connections=2000
# 服务端使用的默认字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
7. Open cmd as administrator
8. After opening, first enter the bin directory under the Mysql installation path (first enter the drive letter of your own installation path :, and then enter the path of the cd bin, for example, if I install it on the E drive, enter it e:
, and then enter it cd E:\mysql\mysql-8.0.19-winx64\bin
), refer to the picture .
- Execute
mysqld --install
command installation
10. After the installation is complete, first initialize: After the initialization mysqld –initialize –console
, there will be a mysql initial password. Be sure to write it down, and you will need to log in to change your own password.
11. Start the service. command:net start mysql
12. Log in to mysql. Command:mysql -u root -p
13. It is recommended to change the password after successful login. Command: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '980824';
14. After changing the password, you can quit (exit) and try to log in again with the new password.
You can log in without entering the Bin directory.
In this way, mysql has been all done. If you want to use it in the future, you can open CMD as an administrator and directly enter the command: mysql -u root –p
to log in and use it.