当前位置:网站首页>Mysql8 installation and environment configuration

Mysql8 installation and environment configuration

2022-06-22 22:27:00 Java factory director

Windows To configure Mysql8

Keep creating , Accelerate growth ! This is my participation 「 Nuggets day new plan · 6 Yuegengwen challenge 」 Of the 28 God , Click to see the event details .

About author

  • The authors introduce

Blog home page : Author URI
brief introduction :JAVA Quality creators in the field 、 A junior at school 、 Participate in various provincial competitions during school 、 National Games , Gain a series of honors Alibaba cloud expert Blogger 51CTO Expert bloggers
Pay attention to me : Pay attention to my learning materials 、 All the documents are downloaded , Update articles regularly every day , Inspirational to be a JAVA Senior program ape


1、 download MySQL 8.0.16

Log in to the official website :downloads.mysql.com/, The official link can be downloaded directly zip Compressed package

image-20220622141817248

image-20220622142041274

image-20220622142121685

image-20220622142149736

Decompress after downloading . My decompression location is D:\environment\Mysql\mysql-8.0.16-winx64

2、 modify environment variable

Add variables to the system variables MYSQL_HOME, The variable value is the installation path D:\environment\Mysql\mysql-8.0.16-winx64

image-20220622150548448

stay path Add %MYSQL_HOME%\bin, Notice that there is no semicolon after this .

image-20220622150610264

3、 Initialize and install

Create a new one under the decompression path you set my.ini file

[mysql]
#  Set up mysql Client default character set 
default-character-set=utf8
[mysqld]
#  Set up 3306 port 
port=3306


#  Set up mysql Installation directory ( Write your own decompression path here )
basedir=D:\environment\Mysql\mysql-8.0.16-winx64
#  Set up mysql Database data storage directory ( Write your own decompression path here and add \data)
datadir=D:\environment\Mysql\mysql-8.0.16-winx64\data


#  Maximum connections allowed 
max_connections=200
#  Number of connection failures allowed .
max_connect_errors=10
#  The character set used by the server defaults to utf8
character-set-server=utf8
#  The default storage engine that will be used when creating a new table 
default-storage-engine=INNODB

After writing , Open as administrator cmd, Enter the command :

mysqld --initialize --console

After executing the last command

image-20220622151026034

Note that the red block diagram in the figure shows the temporary random password , You can record , You need to use .

Install after initialization , Use :

mysqld --install
# After installation 
C:\Windows\system32>mysqld --install
Service successfully installed.
 # uninstall 
mysqld --remove

4、 Start the service and change the password

Start with command mysql service

net start mysql
 # Successful launch 
MySQL  The service is starting  .
MySQL  Service started successfully .

You need to change the password after startup , Enter the command to log in mysql:

mysql -u root -p

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.16

Copyright (c) 2000, 2019, 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.

Here, use the temporary password you need to remember to log in , Then use the command

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' New password ';

Query OK, 0 rows affected (0.01 sec)

Change it to your own password , Here's the new password 6 Above position .

Input quit; , sign out mysql.

️‍ Afterword ️‍

The original purpose of the factory director's blog is very simple , I hope you will avoid detours in the process of learning , Learn more , If you are helpful to yourself, leaving your praise or attention is my greatest support , Your attention and praise give the factory director more motivation every day .

Don't understand part of the article , You can reply to me in the comment area , Let's talk about , Learning together , Progress together !

原网站

版权声明
本文为[Java factory director]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222033414146.html