本文為大家分享了mysql 8.0.19 winx64安裝教程,供大家參考,具體內容如下
1. 下載mysql-8.0.19-winx64
1.1 進入地址:https://dev.mysql.com/downloads/mysql/
1.2 解壓zip包,并將解壓文件 mysql-8.0.19-winx64 文件放在想放的位置,比如 D 盤下,如圖:
1.3 配置環境變量(目的是為了避免在CMD窗口下操作時反復切換路徑)
在Path下添加 D:\mysql-8.0.19-winx64\bin
環境變量設置好之后,以后重新打開CMD或者Windows Powershell,就可直接輸入mysql登陸了,而不用再切換到mysql的bin目錄再執行指令了。
1.4 無需編寫my.ini配置文件(注意)
現在新版的mysql安裝好之后已經沒有my.ini(或my-default.ini)文件了。而且我們也不需要額外的自己添加,因為添加了之后有可能會導致無法啟動mysql的情況,本人已試過。因為之前網上很多的博客教程都會說要添加my.ini(或my-default.ini)文件,但是我們現在不需要添加了。
2. MySQL的初始化及服務安裝
2.1 按“win”鍵打開開始菜單,在搜索框中輸入“cmd”,在搜索結果中選中“命令提示符”程序,右鍵選擇“以管理員身份運行”
2.2 初始化
用管理員權限打開CMD或者Windows Powershell
使用命令:mysqld --initialize --console
使用CMD命令操作后如下:
1
2
3
4
|
C:\Windows\system32>D:\Python\mysql-8.0.12-winx64\bin\mysqld --initialize --console 2018-09-13T14:36:55.758742Z 0 [System] [MY-013169] [Server] D:\Python\mysql-8.0.12-winx64\bin\mysqld (mysqld 8.0.12) initializing of server in progress as process 3104 2018-09-13T14:37:12.072904Z 5 [Note] [MY-010454] [Server] A temporary ** password is generated for root@localhost: `4P!w2fqBruGi`** 2018-09-13T14:37:23.274980Z 0 [System] [MY-013170] [Server] D:\Python\mysql-8.0.12-winx64\bin\mysqld (mysqld 8.0.12) initializing of server has completed |
記錄下密碼,這里的密碼是4P!w2fqBruGi,密碼是隨機生成的每個人都不一樣,此處生成的密碼在后面修改密碼時要用。
2.3 安裝mysql服務
使用命令: mysqld --install
1
2
|
C:\Windows\system32>D:\Python\mysql-8.0.12-winx64\bin\mysqld --install Service successfully installed. |
2.4 啟用服務
使用命令: net start mysql
1
2
3
|
C:\Windows\system32>D:\Python\mysql-8.0.12-winx64\bin>net start mysql MySQL 服務正在啟動 .. MySQL 服務已經啟動成功。 |
2.5 修改密碼
輸入命令登陸: mysql -u root -p
輸入剛才保存的密碼,如 4P!w2fqBruGi
使用命令: ALTER USER ‘root'@‘localhost' IDENTIFIED WITH mysql_native_password BY ‘新密碼';
注意密碼一定要6位數以上
比如我設置的密碼是123456
1
2
3
4
5
6
7
8
9
|
D:\Python\mysql-8.0.12-winx64\bin>mysql -u root -p Enter password : ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.12 mysql> ALTER user 'root' @ 'localhost' IDENTIFIED BY '123456' -> ; Query OK, 0 rows affected (1.98 sec) |
2.6 使用新密碼登陸
使用命令:mysql -u root -p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
D:\Python\mysql-8.0.12-winx64\bin>mysql -u root -p Enter password : ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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> |
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/Boys_Wu/article/details/104022666