1-win10安装mysql8

1.下载安装包

# 本文版本:mysql-8.0.20-winx64.zip

2.解压到安装目录

# 本机安装目录:D:\program\mysql8020\mysql-8.0.20-winx64
# 创建数据目录:D:\program\mysql8020\sqldata

3.新建配置文件

## 在安装目录创建my.ini文件,内容如下:
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\program\mysql8020\mysql-8.0.20-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\program\mysql8020\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

4.管理员权限进入cmd

## 执行如下命令:
C:\WINDOWS\system32>cd /d D:\program\mysql8020\mysql-8.0.20-winx64\bin

D:\program\mysql8020\mysql-8.0.20-winx64\bin>mysqld install
Service successfully installed.

D:\program\mysql8020\mysql-8.0.20-winx64\bin>mysqld --initialize --console
2020-12-16T08:50:39.705780Z 0 [System] [MY-013169] [Server] F:\mysql\bin\mysqld.exe (mysqld 8.0.22) initializing of server in progress as process 872
2020-12-16T08:50:39.708825Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-16T08:50:39.724245Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-16T08:50:52.405847Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-16T08:51:06.888841Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: )<JEVK./s8uJ

D:\program\mysql8020\mysql-8.0.20-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


D:\program\mysql8020\mysql-8.0.20-winx64\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20 MySQL Community Server - GPL

Copyright (c) 2000, 2020, 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> alter user 'root'@'localhost' identified with mysql_native_password by 'ly447742';
Query OK, 0 rows affected (0.08 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

5、navicat连接报错"caching-sha2-password"

# 修改加密规则
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
# 更新密码(mysql_native_password模式)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '{NewPassword}';
posted @ 2020-11-22 22:55  那就这样吧~  阅读(195)  评论(0编辑  收藏  举报