## MySQL专题一:安装与连接(Windows环境mysql版本8.0以上)
[TOC]
### 1.1. 下载Window版本
[https://dev.mysql.com/downloads/installer/](https://dev.mysql.com/downloads/installer/)
### 1.2. 初始化
>mysqld --initialize --console
```bash
C:\Users\Follow>mysqld --initialize --console
2020-04-07T09:14:11.438432Z 0 [System] [MY-013169] [Server] E:\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) initializing of server in progress as process 16388
2020-04-07T09:14:52.316112Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: fAWsp0s0mH=d
```
### 1.3. 启动Mysql服务
>mysqld --console
```bash
C:\Users\Follow>mysqld --console
2020-04-07T09:21:36.435907Z 0 [System] [MY-010116] [Server] E:\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) starting as process 5764
2020-04-07T09:21:45.574180Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-07T09:21:46.022142Z 0 [System] [MY-010931] [Server] E:\mysql-8.0.19-winx64\bin\mysqld.exe: ready for connections. Version: '8.0.19' socket: '' port: 3306 MySQL Community Server - GPL.
2020-04-07T09:21:46.093546Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
```
### 1.4. 连接并修改root密码
新开一个CMD窗口
>mysql -u root -p
>Enter password: fAWsp0s0mH=d(第2步中生成了一个临时的密码fAWsp0s0mH=d)
>alter user 'root'@'localhost' identified with mysql_native_password by '**new Password**';
```bash
C:\Users\Follow>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.19
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> alter user 'root'@'localhost' identified with mysql_native_password by 'root';
Query OK, 0 rows affected (0.24 sec)
```
### 1.5. 断开并重新连接
```bash
mysql> quit
Bye
```
使用新设置的密码,可以正常访问连上
```bash
C:\Users\Follow>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.19 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>
```
- JavaCook
- Java专题零:类的继承
- Java专题一:数据类型
- Java专题二:相等与比较
- Java专题三:集合
- Java专题四:异常
- Java专题五:遍历与迭代
- Java专题六:运算符
- Java专题七:正则表达式
- Java专题八:泛型
- Java专题九:反射
- Java专题九(1):反射
- Java专题九(2):动态代理
- Java专题十:日期与时间
- Java专题十一:IO与NIO
- Java专题十一(1):IO
- Java专题十一(2):NIO
- Java专题十二:网络
- Java专题十三:并发编程
- Java专题十三(1):线程与线程池
- Java专题十三(2):线程安全与同步
- Java专题十三(3):内存模型、volatile、ThreadLocal
- Java专题十四:JDBC
- Java专题十五:日志
- Java专题十六:定时任务
- Java专题十七:JavaMail
- Java专题十八:注解
- Java专题十九:浅拷贝与深拷贝
- Java专题二十:设计模式
- Java专题二十一:序列化与反序列化
- 附加专题一:MySQL
- MySQL专题零:简介
- MySQL专题一:安装与连接
- MySQL专题二:DDL与DML语法
- MySQL专题三:工作原理
- MySQL专题四:InnoDB存储引擎
- MySQL专题五:sql优化
- MySQL专题六:数据类型
- 附加专题二:Mybatis
- Mybatis专题零:简介
- Mybatis专题一:配置文件
- Mybatis专题二:映射文件
- Mybatis专题三:动态SQL
- Mybatis专题四:源码解析
- 附加专题三:Web编程
- Web专题零:HTTP协议
- Web专题一:Servlet
- Web专题二:Cookie与Session
- 附加专题四:Redis
- Redis专题一:数据类型
- Redis专题二:事务
- Redis专题三:key的过期
- Redis专题四:消息队列
- Redis专题五:持久化