1.首先在mysql官網下載最新版mysql, 附上鏈接點擊打開鏈接,根據你的系統型號選擇對應的包下載,大約300多兆,版本號為5.7.19
下載完之后,解壓縮,是一個標準的mysql文件,如圖
2.第二步,配置系統環境變量,桌面→我的電腦→右鍵"屬性"→高級系統設置→環境變量→系統變量→新建
變量名可以根據喜好隨便取,我這里叫做MYSQL_HOME,變量值是你剛剛下載的mysql文件夾所在的目錄,我們指向其中的bin目錄,然后一路確定返回
3.我們的mysql文件中沒有默認的配置文件,我們新建一個.ini的配置文件,名字為my-default.ini,里邊內容如下:
# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** 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 = D:/mysql-server# datadir = D:/mysql-server/data# port = .....# server_id = .....#設置服務器字符集為utf8character_set_server=utf8collation-server=utf8_general_ci#設置mysql的安裝目錄basedir = D:/mysql-server#設置mysql的數據文件存放目錄datadir = D:/mysql-server/data#設置mysql服務所綁定的端口port = 3306#設置mysql允許的最大連接數max_connections=15# 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 [client] #設置客戶端字符集default-character-set=utf8[WinMySQLadmin]Server = D:/mysql-server/bin/mysqld.exesql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
注意里面的幾個路徑,一定要修改為你的mysql文件夾所在的路徑,由于我放的目錄是D:/mysql-server,所以上面的配置路徑都為這個
4.準備安裝mysql,通過命令行工具安裝
首先以管理員身份啟動cmd !!!注意!!!,一定要以管理員身份啟動,否則后面會報錯,提示權限不夠
命令如下: mysqld -install
如果出現以下提示,說明安裝成功
然后開始啟動服務,命令: net start mysql
這時候報錯了,提示無法啟動,3534 ,我們通過 mysqld --console
命令來查看錯誤日志
這里提示,mysql文件夾下沒有/data這個文件或者路徑,這時我們新建一個
我們用命令進入到mysql文件夾的路徑,輸入以下命令:
mysqld --initialize-insecure --user=mysql
執行完上面命令后,MySQL會自建一個data文件夾,并且建好默認數據庫,登錄的用戶名為root,密碼為空
這時我們再重新啟動mysql,發現就能正常啟動了
至此.我們安裝mysql就成功了
總結
以上所述是小編給大家介紹的2017最新版windows安裝mysql教程,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!
新聞熱點
疑難解答