window Environment Configuration Mysql 5.7. 21 windowx 64. zip Installation Free Tutorial Explanation
- 2021-10-13 08:58:13
- OfStack
1. Download mysql-5. 7.21-windowx64. zip mysql download page from official website
2. Extract to the right place (E:\ mysql) This name was changed by me
3. Configure environment variables to add E:\ mysql\ bin to PATH
4. Create the my. ini file in the mysql directory (E:\ mysql) 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=E:\mysql
# Settings mysql The storage directory of the data in the database
datadir=E:\mysql\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
"#" For comments
5. Run cmd as an administrator
Switch Directory
cd E:\mysql\bin
Generate the mysql service (that is, install the my. ini file)
E:\mysql\bin> mysqld -install;
Service successfully installed.
Generate the data directory
E:\mysql\bin> mysqld --initialize-insecure --user=mysql
;
If the generation fails here, see the following
E:\mysql\bin>cd ../
E:\mysql> mysqld --initialize-insecure --user=mysql ;
Start the mysql service
E:\mysql\bin> net start mysql;
The MySQL service is starting.
The MySQL service has started successfully.
6. Log in to the database and change the password (blank by default)
E:\mysql\bin> mysql -u root -p;
Enter password: // Enter directly here
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Database changed
mysql> set password for 'root'@'localhost'=password(' New password ');
mysql> flush privileges;
Is exiting the test successful
mysql> quit;
E:\mysql\bin> mysql -u root -p;
Enter password:
Note:
In mysql, one statement ends and is added; No.
Start mysql service net start mysql;
Stop mysql service net stop mysql;
Generate services mysqld-install;
Delete services mysqld-remove;
Login database mysql-u root-p;
Exit mysql
>
quit;
Summarize