windows安裝mysql-5.7壓縮版詳細教程,windowsmysql-5.7

來源:互聯網
上載者:User

windows安裝mysql-5.7壓縮版詳細教程,windowsmysql-5.7
前言今天安裝mysql資料庫,進入mysql官網,對於windows來說有兩個版本的檔案可下載,一是.msi安裝檔案,二是.biz壓縮包。以前一直用安裝檔案進行安裝,百試不爽。今天突然不想用安裝檔案了,是時候用壓縮包進行安裝了。於是下載了壓縮包,搜尋了些安裝教程,安裝起來的mysql服務總是報錯,再找教程,還是啟動不了服務……於是,我不相信百度了。進入mysql官網,找到mysql5.7的文檔:http://dev.mysql.com/doc/refman/5.7/en/installing.html,一步一步來,終於成功了。
下載mysql

  • 進入官網:https://www.mysql.com/

  • 單擊【Downloads】選項卡
  • 最下面有個【 MySQL Community Edition  (GPL)】,單擊【Community (GPL) Downloads »】
  • 單擊【MySQL Community Server (GPL)】下的【DOWNLOAD】
  • 在彈出的頁面上下載【Windows (x86, 64-bit), ZIP Archive】
安裝mysql壓縮包相當於免安裝檔案,要想使用它,需要配置正確,並通過服務來啟動資料庫服務。1.把壓縮包解壓到你喜歡的位置本樣本解壓到:D:\mysql-5.7.13-winx64,檔案夾下


2.建立my.ini檔案,內容如下:[plain] view plain copy
  1. [mysqld]  
  2. port=3306  
  3. basedir  ="D:\\mysql-5.7.13-winx64\\"  
  4. datadir  ="F:\\mysqlData\\"  
  5.   
  6.   
  7. max_allowed_packet = 32M  
 注意,basedir和datadir是必須要配置的,basedir就是你解壓的目錄。官方文檔上說,如果你喜歡用斜杠,則要用雙斜杠,反斜線的話就不用這樣。即:D:\\mysql-5.7.13-winx64\\ 或:D:/mysql-5.7.13-winx64/由於本人喜歡把資料庫的資料檔案獨立出來,所以就把datadir配置到其它地方,方便管理。另外,建立該目錄。
3.配置環境變數
  • 添加一個名叫 MYSQL_HOME 的變數。
  • 修改Path變數,在末尾添加 %MYSQL_HOME%\bin 
4.安裝mysql服務
  • 以管理員身份運行cmd,進入mysql的bin目錄。
  • 初始化資料庫檔案
[plain] view plain copy
  1. mysqld  --initialize  
 初始化成功後,會在datadir目錄下產生一些檔案,其中,xxx.err檔案裡說明了root賬戶的臨時密碼。那行大概長這樣:[plain] view plain copy
  1. 2016-07-24T05:19:20.152135Z 1 [Note] A temporary password is generated for root@localhost: bL2uuwuf0H(X  

即密碼是:bL2uuwuf0H(X
  • 註冊mysql服務
[html] view plain copy
  1. mysqld -install MySQL  
  • 啟動mysql服務
[plain] view plain copy
  1. net start MySQL  

  • 修改root密碼

[sql] view plain copy
  1. mysql -u root -p  
[sql] view plain copy
  1. ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';  

查看評論

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.