windwos10 安装Mysql8.0 2021最新傻瓜式教程

这个教程教你的是若是经过压缩包安装,而不是installermysql

下载Mysql

下载地址 https://dev.mysql.com/downloa...sql

下载Windows (x86, 64-bit), ZIP Archive,即体积比较小的那个shell

image.png

解压缩

解压缩以后放到C盘
C:\Program Files\Mysqlbash

image.png

Program Files文件夹建立一个 Mysql文件夹,把解压后的文件夹放到 Mysql文件夹

添加环境变量

C:\Program Files\Mysql\mysql-8.0.21-winx64\bin添加到环境变量中spa

注意把 mysql-8.0.21-winx64换成你本身的版本

添加服务

mysqld install

添加过环境变量就须要中相对路径或者绝对路径去调用mysqldcode

注意是mysqld,不是mysql,由于 mysql是客户端程序, mysqld是服务端程序

配置

有些教程会教你配置my.ini,这个文件不是必须的,因此这里不讲server

> cd "C:\Program Files\Mysql\mysql-8.0.21-winx64"

> mysqld.exe --initialize --console
2021-05-15T03:14:48.650104Z 0 [System] [MY-013169] [Server] C:\Program Files\Mysql\mysql-8.0.21-winx64\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 6040
2021-05-15T03:14:48.689134Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-15T03:14:49.796361Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-05-15T03:14:51.118883Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: _<AsDttMd1o2


> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

> mysql -u root -p"_<AsDttMd1o2"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21

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>
注意把 mysql-8.0.21-winx64换成你本身的版本

上诉操做中有容易踩坑的地方教程

  • mysqld.exe --initialize --console中的--console不可少,否则会很麻烦
  • 输入密码最好直接在-p后面,显示添加,不要少了引号,这很重要.

常见报错

  • ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    解决办法:输入密码最好直接在-p后面,显示添加,不要少了引号,这很重要.
相关文章
相关标签/搜索