一、配置文件配置如下:
如何获得my.ini 将my-default.ini复制一份并更名为my.ini
修改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.
[mysqld]
character-set-server=utf8
default-storage-engine=INNODB
# 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 = C:\mysql-5.7.13-winx64\
datadir = C:\mysql-5.7.13-winx64\data
port = 3306
server_id = 1
# 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
二、安装MySQL数据库在CMD命令行里如下:
-
Microsoft Windows [版本 10.0.16299.15] (c) 2017 Microsoft Corporation。保留所有权利。
-
切换到MySQL 解压目录下的bin目录
C:\Windows\system32>cd /d c:\mysql-5.7.13-winx64\bin -
初始化安装配置目录会在根目录下产生一个存放数据的data文件
c:\mysql-5.7.13-winx64\bin>initialize-insecure
-
如果出现以下信息提示则可能已经初始化过了,要吗啊删除掉根目录下的data 要吗直接执行第5步,。
'initialize-insecure' 不是内部或外部命令,也不是可运行的程序
或批处理文件。 -
根据引导文件my.ini文件安装配置文件安装
c:\mysql-5.7.13-winx64\bin>mysqld --install mysql57 --defaults-file="C:\mysql-5.7.13-winx64\my.ini" -
安装成功
Service successfully installed. -
启动MySQL
c:\mysql-5.7.13-winx64\bin>net start mysql57 -
启动状态
mysql57 服务正在启动 .
mysql57 服务已经启动成功。