MySQL installation tutorial 20/10/26

MySQL installation

First download MySQL

download link

Unzip it to any directory you want (it is recommended to make a mark and name carefully)

Configure environment variables

Right-click the My Computer icon, select Properties-Advanced System Settings-Environment Variables-New

Create a new system variable, the variable name is: MYSQL_HOME, the path is the path you just unzipped

Edit the path in the system variable, add %MYSQL_HOME%\bin\
pay attention to the case and symbol format

Create a new folder Data to store the database in the MySQL directory, create a
new my.ini file, and write:

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=(你mysql的安装目录)
# 设置mysql数据库的数据的存放目录
datadir=(你mysql的Date目录)
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

Search cmd in the search bar in the lower left corner, and right-click to select Run as administrator

Enter: mysqld install command.
When Service successfully installed appears, the MySQL service has been successfully installed

Execute command: mysqld --initialize --consolecomplete MySQL initialization

After the execution is complete, cmd will print the initial default password of the root user, which is a few characters after root@localhost:

[Note] [MY-010454] [Server] A temporary password is generated for root@localhost:********

After the initialization is complete, execute and net start mysqlstart the MySQL service

Execute the mysql -u root -pcommand and enter the previous password when prompted

After successfully entering the database, execute the
ALTER USER 'root'@'localhost' IDENTIFIED BY '新的密码';
command to modify the database password

Enter to exitexit MySQL

Guess you like

Origin blog.csdn.net/qq_44685947/article/details/109282262