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

a724888發表於2019-09-01

1 下載安裝包

1.1 壓縮包

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

1.2 安裝包

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

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

2 配置環境變數

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

3 初始化MySQL

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

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

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

3.1 記住你的初始密碼

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

2019-08-24T11:55:10.299750Z 0 [System] [MY-013169] [Server] F:\DEV\env\mysql-8.0.17-winx64\bin\mysqld.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:\DEV\env\mysql-8.0.17-winx64\bin\mysqld.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

在這裡插入圖片描述


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69906029/viewspace-2655677/,如需轉載,請註明出處,否則將追究法律責任。

相關文章