MySQL8.0 下載安裝啓動(Windows10)

2019年6月13日20:13:21html

MySQL8.0 下載安裝啓動(Windows10)

下載

下載地址:https://dev.mysql.com/downloads/mysql/8.0.htmlmysql

如今的版本是:MySQL Community Server 8.0.16sql

解壓

解壓到安裝目錄,好比F盤根目錄,F:\mysql-8.0.16-winx64數據庫

建立my.ini

my.ini是MySQL安裝的配置文件windows

[mysql]
# 設置mysql客戶端默認字符集
default-character-set=utf8mb4
[mysqld]
# 設置3306端口
port=3306
# 設置mysql的安裝目錄
basedir=D:\\develop\\software\\mysql-8.0.13-winx64
# 設置 mysql數據庫的數據的存放目錄,MySQL 8+ 不須要如下配置,系統本身生成便可,不然有可能報錯
# datadir=D:\\develop\\software\\mysql-8.0.13-winx64\\data
# 容許最大鏈接數
max_connections=20
# 服務端使用的字符集默認爲8比特編碼的latin1字符集
character-set-server=utf8mb4
# 建立新表時將使用的默認存儲引擎
default-storage-engine=INNODB

初始化

以管理員權限打開cmd,在F:\mysql-8.0.16-winx64\bin目錄下執行:socket

mysqld --defaults-file=F:\mysql-8.0.16-winx64\my.ini --initialize --console工具

控制檯有輸出以下,說明安裝成功:編碼

F:\mysql-8.0.16-winx64\bin>mysqld --defaults-file=F:\mysql-8.0.16-winx64\my.ini --initialize --console  
2019-06-13T13:05:12.739945Z 0 [System] [MY-013169] [Server] F:\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server in progress as process 16556  
2019-06-13T13:05:53.869171Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8WEM&pMQk#xR  
2019-06-13T13:06:06.142279Z 0 [System] [MY-013170] [Server] F:\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server has completed

這裏root@localhost: 8WEM&pMQk#xR8WEM&pMQk#xR就是數據庫的初始密碼。稍後須要更改。命令行

啓動、關閉

啓動MySQL server,只須要執行mysqld便可,mysqld --console能夠在控制檯輸出日誌。日誌

F:\mysql-8.0.16-winx64\bin>mysqld --console
2019-06-14T11:20:12.875518Z 0 [System] [MY-010116] [Server] F:\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) starting as process 13788
2019-06-14T11:20:17.477755Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-06-14T11:20:17.998981Z 0 [System] [MY-010931] [Server] F:\mysql-8.0.16-winx64\bin\mysqld.exe: ready for connections. Version: '8.0.16'  socket: ''  port: 3306  MySQL Community Server - GPL.
2019-06-14T11:20:18.071514Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060

在命令行中只需「CRTL + C」就能夠關閉數據庫,也能夠使用

登陸

使用mysql -uroot -p登陸,輸入上面的那個密碼8WEM&pMQk#xR便可

F:\mysql-8.0.16-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16

Copyright (c) 2000, 2019, 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 '你的密碼';

注意:mysql8新的密碼策略,不少mysql客戶端工具不支持,因此用原來的密碼策略

2019年6月14日20:00:06

相關文章
相關標籤/搜索