從零開始搭建Java開發環境第二篇:如何在windows10裏安裝MySQL

1 下載安裝包

1.1 壓縮包

https://dev.mysql.com/downloads/mysql/mysql

[外鏈圖片轉存失敗(img-oesO8K09-1566652568838)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]git

1.2 安裝包

使用安裝包安裝則無需後續步驟sql

https://dev.mysql.com/downloads/file/?id=488055shell

[外鏈圖片轉存失敗(img-Y3x59iO4-1566652568839)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]數據庫

2 配置環境變量

[外鏈圖片轉存失敗(img-RBgnyR9U-1566652568840)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]segmentfault

3 初始化MySQL

[外鏈圖片轉存失敗(img-pVrsH1g4-1566652568841)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]bash

在MySQL路徑下輸入命令mysqld --initialize --user=mysql --consoleide

[外鏈圖片轉存失敗(img-4a4YX8nO-1566652568842)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]編碼

3.1 記住你的初始密碼

[外鏈圖片轉存失敗(img-IQFQj1kT-1566652568842)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]spa

2019-08-24T11:55:10.299750Z 0 [System] [MY-013169] [Server] F:DEVenvmysql-8.0.17-winx64binmysqld.exe (mysqld 8.0.17) initializing of server in progress as process 27232 2019-08-24T11:55:10.355861Z 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. 2019-08-24T11:55:33.531673Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: k;k;w6OJEZ#Q

2019-08-24T11:55:45.353166Z 0 [System] [MY-013170] [Server] F:DEVenvmysql-8.0.17-winx64binmysqld.exe (mysqld 8.0.17) initializing of server has completed

4 啓動服務

[外鏈圖片轉存失敗(img-LVA4VR9p-1566652568842)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "點擊並拖拽以移動")]

  • 接着就是輸入mysqld -install進行服務的添加
  • 輸入net start mysql啓動服務
  • 輸入mysql -u root -p進行登陸數據庫,這時提示須要密碼,而後就是用你上面的密碼登陸
  • 修改密碼語句:ALTER USER root@localhost IDENTIFIED BY '123456'; 修改密碼爲:123456

若是控制檯亂碼,能夠改編碼爲utf-8

若是用git bash遇到問題,可使用Windows自帶的cmd或者powershell

在這裏插入圖片描述

相關文章
相關標籤/搜索