mysql-8.0.21安装

mysql-8.0.21安装

  • 安装文件
  • mysql-8.0.21安装配置

安装文件

  1. 登录mysql官网
    https://dev.mysql.com/downloads/workbench/
    选择GA版本
    mysql-8.0.21安装_第1张图片
  2. 点击“不用了,请直接下载”,可直接开始下载
    mysql-8.0.21安装_第2张图片
  3. 下载成功,得到压缩包mysql-8.0.21-winx64.zip。

mysql-8.0.21安装配置

  1. 解压,添加系统变量路径,选择“Path”->“编辑”
    mysql-8.0.21安装_第3张图片
  2. 点击“新建”,输入加压后mysql8的bin目录路径,
    mysql-8.0.21安装_第4张图片
  3. 在解压后的mysql-8.0.21-winx64目录下(与bin目录同一级),新建my.ini文件,配置如下内容:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = E:\mysql-8.0.21-winx64
datadir = E:\mysql-8.0.21-winx64\data
port = 3306
max_connections = 200
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

[mysql]
default-character-set=utf8

[client]
port=3306
default-character-set=utf8
  1. 以管理员身份运行cmd.exe,导航到mysql8的bin目录下
    在这里插入图片描述
  2. 安装mysql,执行命令
mysqld --install mysql

在这里插入图片描述
6. mysql初始化,生成data目录,执行命令

mysqld --initialize --console

mysql-8.0.21安装_第5张图片
初始密码,如果不小心关掉了密码没保存那就删掉data目录重新初始化。
7. 开启服务,执行命令

net start mysql

mysql-8.0.21安装_第6张图片
8. 登录,执行命令

mysql -u root -p

提示输入密码,输入root初始密码
mysql-8.0.21安装_第7张图片
9. 修改密码,输入mysql命令

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

在这里插入图片描述
安装完毕。

你可能感兴趣的:(数据库,mysql)