mysql 5.7. 21 Installation Configuration Tutorial of window
- 2021-10-11 19:47:16
- OfStack
Install mysql 5.7. 21 in the window environment as follows
1. Download the installation-free compressed package mysql-5. 7.21-winx64. zip from MySQL official website
2. Extract to the appropriate directory (extract here to F:\ mysql-5. 7.21-winx64)
3. Configure the environment variable to add the startup directory of MySQL (F:\ mysql-5. 7.21-winx64\ bin) to Path
4. Create the my. ini file under the MySQL directory (F:\ mysql-5. 7.21-winx64) as follows:
[mysql]
# Settings mysql Client default character set
default-character-set=utf8
[mysqld]
# Settings 3306 Port
port = 3306
# Settings mysql Installation directory of
basedir=F:\mysql-5.7.21-winx64
# Settings mysql The storage directory of the data in the database
datadir=F:\mysql-5.7.21-winx64\data
# Maximum number of connections allowed
max_connections=200
# The character set used by the server defaults to 8 Bit coded latin1 Character set
character-set-server=utf8
# Default storage engine to be used when creating new tables
default-storage-engine=INNODB
5. Run cmd as an administrator
Switch directory: C:\ Windows\ system32
>
cd F:\mysql-5.7.21-winx64\bin
Generate the MySQL service:
F:\mysql-5.7.21-winx64\bin>mysqld -install
Service successfully installed.
Generate data directory: F:\ mysql-5. 7.21-winx64\ bin > mysqld --initialize-insecure --user=mysql
Start the MySQL service:
C:\Windows\system32>net start mysql
MySQL Service is starting .
MySQL The service has started successfully.
6. Log in to the database and change the password (the default password is empty)
Login database:
C:\Windows\system32>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Change password:
mysql>
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Database changed
mysql> update user set authentication_string=password(" New password ") where User="root";
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql>
mysql>FLUSH PRIVILEGES;
Wonderful topic sharing: mysql installation tutorials for different versions of mysql 5.7 installation tutorials for different versions