## 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專題五:持久化