Table of contents
1 Download the installation package
Download URL:
https://dev.mysql.com/downloads/Choose
this
2 installation
Write the MySQL configuration file and
create a new my.ini file in the unzipped directory.
Copy the following text into my,ini file
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录 ----------是你的文件路径-------------
basedir=D:\\mysql-8.0.26-winx64\\mysql-8.0.26-winx64
# 设置mysql数据库的数据的存放目录 ---------是你的文件路径data文件夹自行创建
#datadir=E:\\mysql\\mysql\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4
Initialize the MySQL database.
Open the command prompt as an administrator
and switch to the bin directory.
Execute the command in the bin directory under the MySQL directory:
mysqld --initialize --console
My random password is: 2(eE8rwv#a(?
Install the mysql service and start it
mysqld --install mysql
Start the mysql service
net start mysql
Connect to MySQL
mysql -uroot -p
Enter the random password just now
change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY '111111';
You can enter quit or exit to exit.
To log in, you can use mysql -uroot -p