服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|数据库技术|

服务器之家 - 数据库 - Mysql - MySql 5.7.17免安装配置教程详解

MySql 5.7.17免安装配置教程详解

2020-07-22 16:32逍遥小白 Mysql

这篇文章给大家详细介绍了MySql 5.7.17免安装配置教程,首先大家需要先下载mysql 5.7.17 的安装包,然后解压,具体配置过程大家通过本文一起学习吧

1、下载mysql-5.7.17-winx64.zip安装包(链接:https://dev.mysql.com/downloads/mysql/)

2、解压安装包。

D:\DevelopTool\mysql-5.7.17-winx64   #解压目录

3、在解压目录下创建一个名为data的文件夹,用来存放数据

D:\DevelopTool\mysql-5.7.17-winx64\data

4、配置启动文件

  把 D:\DevelopTool\mysql-5.7.17-winx64\my-default.ini 文件copy一份,重新命名为 my.ini ,修改里面的参数,如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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]
# 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 为安装文件解压后的目录 | basedir和datadir 可以使用相对路径
# basedir=./..
basedir=D:\\DevelopTool\\mysql-5.7.11-winx64
# datadir 为用来存放数据的目录
# datadir=./../data
datadir=D:\\DevelopTool\\mysql-5.7.11-winx64\\data
# port 为端口号
port=3306
# mar_connections为最大连接数
max_connections=20
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
explicit_defaults_for_timestamp=true
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

 5、初始化数据目录

?
1
mysqld --defaults-file="D:\DevelopTool\mysql-5.7.17-winx64\my.ini" --initialize-insecure

它会初始化 data 目录,在执行此命令前请先把data目录下的所有文件先删除,否则会失败

可以选择用 --initialize-insecure 或者 --initialize 来初始化,--initialize-insecure 初始化root密码为空,如果用 --initialize来初始化,会产生一个随机密码

  执行成功后,在data目录下会生成mysql,perofrmance_schema,sys等目录文件

6、安装和启动mysql服务

?
1
2
3
4
5
6
7
8
#安装服务
mysqld -install
#启动服务
net start mysql
#进入mysql
mysql -u root -p
#移除mysql
mysqld -remove

以上所述是小编给大家介绍的MySql 5.7.17免安装配置教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://www.cnblogs.com/White7099/articles/6365037.html

延伸 · 阅读

精彩推荐