1. Download the zip package from the MySQL official website and decompress the zip package.
Hello friends, it’s another day to get new skills every day, get started with 0 basics, get in the car while it’s hot~~.
Today, let's take a look at how to install the MySQL_8.zip community version~.
MySQL official website:
After decompressing the downloaded file, the directory is as shown below
2. Create and configure the my.ini file (in the bin directory)
basedir=path after file decompression (emphasis)
[mysqld]
##设置3306端口
port=3306
##设置mysql的安装目录
basedir=D:\mysql-8.0.21-winx64\
##设置mysql数据库的数据的存放目录
datadir=D:\mysql-8.0.21-winx64\Data
##允许最大连接数
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
2.1 Configure the environment variable path (to facilitate cmd to operate the database)
Path: "Computer" – "Properties" – "Advanced System Settings" – "Advanced" – "Environment Variables" – "System Variables" – "path"
Variable name: path
Variable value: ;D:\mysql-8.0.21-winx64; (the installation directory of mysql is separated by ; for win7, but not for win10)
3. Initialize the mysql service.
Enter cmd as an administrator : mysqld --initialize --console Be sure to remember the initialization password! ! ! ! (Focus! Focus! Focus!)
4. Install and start the mysql service.
Install mysql service: mysqld --install
Start mysql service: net start mysql
5. Modify the initial password.
Log in to MySQL (the password is the initialized password)
mysql>mysql -uroot -p
Modify the initial password
mysql>alter user root@localhost identified by '123456';
6. Import other people's database
– copy the database,
– the premise is to create a database name consistent with the database name.sql file
– in mysql> create database database name;
– in mysql> use database name;
– in mysql> source .sql File path (must not contain Chinese)