第一步:解壓mysql,例如解壓後的目錄在C:\Program Files\mysql-5.6.36-winx64html
第二步:配置mysql環境變量,相似配置java的環境變量java
計算機右鍵===>屬性===>高級系統設置===>高級===>環境變量mysql
新建系統變量:sql
變量名:MYSQL_HOME服務器
變量值:C:\Program Files\mysql-5.6.36-winx64字體
編輯系統變量Path,追加%MYSQL_HOME%\bin;ui
第三步:進入C:\Program Files\mysql-5.6.36-winx64,將my-default.ini重命名爲my.ini,並進行以下配置(紅色字體):spa
# For advice on how to change settings please seeserver
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.htmlhtm
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
basedir = C:\Program Files\mysql-5.6.36-winx64
datadir = C:\Program Files\mysql-5.6.36-winx64\data
character_set_server=utf8
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
default-character-set=utf8
第四步:使用管理員操做DOS命令,依次輸入:
進入mysql的bin目錄:cd C:\Program Files\mysql-5.6.36-winx64\bin
安裝mysql:mysqld –install
啓動mysql服務器:net start mysql
登錄mysql:mysql –uroot –p 回車,這時提示輸入密碼,暫時沒有密碼,直接回車便可
第五步:修改mysql的root帳戶的密碼,繼續輸入以下命令:
use mysql;
update user set password=password("新密碼") where user="root";
flush privileges;