This article is downloaded the latest version of MySQL 8.0.19, windows 64-bit ZIP package, my computer system is Windows 10.
The downloaded archive, extract to D:\mysql-8.0.19-winx64
prepare the unpacked directory configuration file my.ini, and folder data.
1. write configuration file my.ini
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=M:\mysql-8.0.19-winx64
# 设置mysql数据库的数据的存放目录
datadir=M:\mysql-8.0.19-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
2. Configure Environment Variables
A directory is added after the decompression MYSQL_HOME value: M:\mysql-8.0.19-winx64
then add mysql bin position in the Path:% MYSQL_HOME% \ bin
3. Installation Services
Cmd to run as an administrator, using the cd command to switch to the position you actually installed, for example,M:\mysql-8.0.19-winx64\bin
- Enter the installation command: mysqld --install [service name]
PS:
1, do not write the name of the service, the default is mysql
before 2, if the alert service already exists, execution sc delete [service name] you can delete the service
If you encounter the following figure, the need to replace the administrator performs the command prompt to
If you have tips 提示缺少vcruntime140_1.dll
, you need to install VC ++ runtime, Microsoft common runtime library collection , restart the system after the installation is complete, you can re-take this step
- Execute mysqld --initialize --console (initialization) recorded the root temporary password
4. Start Services
Execute net start mysql (run)
Other commonly used commands
mysqld --remove 移除服务 net stop mysql 停止mysql服务
5. Configure MySQL root password
* 执行 `mysql -u root -p` 使用临时密码登录
* `ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';` 设置root密码为password,
MySQL installation complete
Based on the original link: modify it based on //www.jianshu.com/p/5433b43eacbf: https