win7 64位安裝mysql,win764位mysql

來源:互聯網
上載者:User

win7 64位安裝mysql,win764位mysql

版本:mysql官網,下載win7-64位的mysql服務端安裝包。

解壓:C:\Program Files\mysql\mysql-5.6.25-winx64。

配置環境變數:MYSQL_HOME=C:\Program Files\mysql\mysql-5.6.25-winx64,添加到Path中:%MYSQL_HOME%/bin

配置:更改my-default.ini檔案名稱為my.ini,在[mysqld]下面添加一行編碼:character-set-server = gbk

添加3個服務啟動參數:

basedir = C:/Program Files/mysql/mysql-5.6.25-winx64/
datadir = C:/Program Files/mysql/mysql-5.6.25-winx64/data/
tmpdir = C:/Program Files/mysql/mysql-5.6.25-winx64/temp/
user=mysql

此時安裝mysql,命令:mysqld --install MySQL --defaults-file="my.ini"

啟動mysql,命令:net start MySQL

會發現報錯“無法啟動 發生系統錯誤2”,是因為免安裝,系統不知道設定檔載入路徑,系統預設載入了一個不存在的路徑,

所以需要更改路徑,進到註冊表:

HKEY_LOCAL_MACHINE-SYSTEM-CurrentControlSet-services-mysql(服務名)-ImagePath

講值改為:"C:\Program Files\mysql\mysql-5.6.25-winx64\bin\mysqld" --defaults-file="C:\Program Files\mysql\mysql-5.6.25-winx64\my.ini" MySQL

再次執行命令:net start MySQL,如果參數都配置正確,切tmpdir路徑已經存在,則啟動成功;

反之報錯,修改參數,重新啟動即可。

注意:datadir位安裝包解壓出來的data目錄,tmpdir目錄必須存在,mysql啟動時會檢查目錄是否存在,不會自動建立。

MySQL服務的啟動、停止與卸載

在 Windows 命令提示字元下運行:

啟動: net start MySQL

停止: net stop MySQL

卸載: sc delete MySQL



相關文章

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.