1. Download the decompressed version mysql
mysql-5.7.37-winx64 or other versions
2. Unzip to a custom path for installation
for example:
D:\Develop\mysql-5.7.37
3. Manually create the my.ini file and the data directory in the installation root directory
3.1 Create my.ini file
D:\Develop\mysql-5.7.37\my.ini
3.2 Create data data storage file
Create a new data folder in the D:\Develop\mysql-5.7.37 directory, which must be empty
3.3 Modify the my.ini file
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir = D:\\Develop\\mysql-5.7.37\\
# 设置mysql数据库的数据的存放目录
datadir = D:\\Develop\\mysql-5.7.37\\data
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 创建模式
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Note: Modify basedir, datadir is your own path, pay attention to the double slash \\
4. Configure mysql environment variables
4.1 Create a new MYSQL_HOME variable
4.2 Add MYSQL_HOME\bin to the path
5. Use the system administrator mode cmd to mysql installation path
5.1 Find the command prompt on the left side of the computer
5.2 Execute the following two commands successively in the bin directory
Install MySQL Windows Service
mysqld -install
Problems may arise at this point, such as: 'mysqld' is not recognized as an internal or external command or operable program
There are two options for this question:
1. The environment variable is not configured properly
2. Check if there is an executable file mysqld.exe in the bin directory, if not, download the other ones again
Installation package!
If the installation is successful, it will prompt "Service successful installed
initialization
mysqld --initialize-insecure
Problems may also arise at this point, such as:
Download the corresponding program installation package to solve the problem. Pay attention to the download address of whether to install 32-bit or 64-bit according to the number of computer bits.
6. Enable the automatic start mysql service in the service (it doesn’t matter if you don’t open it)
7. Start the mysql service net start mysql or start it in the service
net start mysql
7.1 Check whether mysql starts successfully
7.2 Modify the initial password
The initial password will be generated during initialization, in the user name.err file under data
Execute the relevant sql statement on Baidu, so I won’t write it here!