本文記錄了mysql 5.7.21安裝配置方法,具體內(nèi)容如下
1.下載
下載地址
解壓到自己喜歡的一個(gè)位置即可(目錄中不要包含中文)
如:D:\Program Files\
2.系統(tǒng)環(huán)境變量配置
(1)新增系統(tǒng)變量
變量名:MYSQL_HOME
變量值:Mysql解壓目錄,如D:\Program Files\mysql-5.7.21-winx64
(2)追加PATH
;%MYSQL_HOME%\bin;
3.配置my.ini文件
在解壓根目錄新建一個(gè)my.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:\\Program Files\mysql-5.7.21-winx64"
datadir = "D:\\Program Files\mysql-5.7.21-winx64\data"
port = 3306
character_set_server = utf8
# server_id = .....
# 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
4.管理員方式啟動(dòng)命令提示窗符
進(jìn)入mysql解壓目錄到bin目錄下
如:D:\Program Files\mysql-5.7.21-winx64\bin
分別執(zhí)行:
(1)初始化:mysqld -initialize-insecure
如果報(bào)錯(cuò)failed to set datadir to 則 執(zhí)行一下 mysqld --initialize --user=mysql --console,再執(zhí)行(1);
正確之后會(huì)在Mysql解壓根目錄生成data文件夾以及相關(guān)文件
(2)mysqld -install
*如提示Install/Remove of the Service Denied,說明不是已管理員的方式進(jìn)入的命令提示符
(3)啟動(dòng)服務(wù):net start mysql
(4)登陸,改密碼 mysql -u root -p
【成功登陸的直接到(5)】
我的出現(xiàn)了
在my.ini中增加
重啟服務(wù),成功登陸
(5)執(zhí)行改密碼語句 (正常登陸的使用set password= password(‘新密碼'); )
update user set authentication_string = password("新密碼") where user='root';
(6)exit; net stop mysql
(7)登陸成功的忽略這一步
到my.ini中注釋掉
重啟進(jìn)入之后set password= password(‘新密碼');
到此就可以正常使用了。
(8)測(cè)試 show databases;
5.寫兩個(gè)bat文件用于啟動(dòng)和關(guān)閉mysql服務(wù)
(1)啟動(dòng)mysql服務(wù)
@echo off
echo 確定要啟動(dòng)MySQL服務(wù)嗎?
pause
net start mysql
echo 啟動(dòng)MySQL服務(wù)完成,請(qǐng)確認(rèn)有沒有錯(cuò)誤發(fā)生。
Pause
保存為 mysql服務(wù)啟動(dòng).bat 文件,運(yùn)行時(shí)要以管理員方式運(yùn)行
(2)關(guān)閉mysql服務(wù)
@echo off
echo 確定要關(guān)閉MySQL服務(wù)嗎?
pause
net stop mysql
echo 關(guān)閉MySQL服務(wù)完成,請(qǐng)確認(rèn)有沒有錯(cuò)誤發(fā)生。
Pause
保存為 mysql服務(wù)關(guān)閉.bat 文件,運(yùn)行時(shí)要以管理員方式運(yùn)行
MySql到此安裝結(jié)束。
精彩專題分享:
mysql不同版本安裝教程
mysql5.7各版本安裝教程
mysql5.6各版本安裝教程
mysql8.0各版本安裝教程
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- mysql 5.7.21 winx64免安裝版配置方法圖文教程
- windows 10下mysql 5.7.21 winx64安裝配置方法圖文教程
- mysql 5.7.21 winx64安裝配置方法圖文教程
- mysql-5.7.21-winx64免安裝版安裝--Windows 教程詳解