Windows10下mysql 8.0.19 winx64安裝教程及修改初始密碼
本文為大家分享了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
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
使用CMD命令操作後如下:
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
C:\Windows\system32>D:\Python\mysql-8.0.12-winx64\bin\mysqld --install Service successfully installed.
2.4 啟用服務
使用命令: net start mysql
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
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
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>
精彩專題分享:
mysql不同版本安裝教程
mysql5.7各版本安裝教程
mysql5.6各版本安裝教程
mysql8.0各版本安裝教程
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支援我們。