- 1.下载安装包
- 2.解压到本地目录
F:\mysql-5.7.21-winx64
- 3.新增mysql环境变量
MYSQL_HOME = F:\mysql-5.7.21-winx64
- 4.修改Path环境变量
Path变量下,末尾新增 ;%MYSQL_HOME%\bin;
- 5.手动新建相关文件夹/文件(文件内容为空即可)
F:\mysql-5.7.21-winx64\xudebiao
F:\mysql-5.7.21-winx64\xudebiao\data
F:\mysql-5.7.21-winx64\xudebiao\log
F:\mysql-5.7.21-winx64\xudebiao\log\mysql-error.log
F:\mysql-5.7.21-winx64\xudebiao\tmp
F:\mysql-5.7.21-winx64\xudebiao\tmp\mysql.sock
- 6.新建my.ini配置文件
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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.
[client]
port=3306
socket=F:\mysql-5.7.21-winx64\xudebiao\tmp\mysql.sock
default-character-set=utf8
[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 = .....
# socket = .....
user=mysql
basedir=F:\mysql-5.7.21-winx64
datadir=F:\mysql-5.7.21-winx64\xudebiao\data
port=3306
socket=F:\mysql-5.7.21-winx64\xudebiao\tmp\mysql.sock
max_connections=1000
max_connect_errors=1000
table_open_cache=1024
max_allowed_packet=128M
character_set_server=utf8
collation-server=utf8_general_ci
lower_case_table_names=1
log_error=F:\mysql-5.7.21-winx64\xudebiao\log\mysql-error.log
slow_query_log=1
long_query_time=1
slow_query_log_file=F:\mysql-5.7.21-winx64\xudebiao\log\mysql-slow.log
symbolic-links = 0
# 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
- 7.准备工作做好的截图
- 8.执行安装命令
管理员身份运行"命令提示符"
进入F:\mysql-5.7.21-winx64\bin
第一步执行初始化操作: mysqld --initialize-insecure
第二步执行安装服务操作: mysqld install
第三步启动mysql服务: net start MySQL
【正常情况下这里会直接提示成功。如果失败了,上面第5步清空data(F:\mysql-5.7.21-winx64\xudebiao\data)目录,再次执行命令】
- 9.修改初始密码
mysql -u root -p
第一次登陆没有密码, 输入密码的时候直接回车
set password = password(‘1990xxxx‘);
- 10.登陆测试
- 11.确认编码格式utf8
show variables like ‘%character%‘;
好了, 可以开车上路了~
原文地址:https://www.cnblogs.com/debiao/p/8366436.html