首页 > 数据库 > MySQL > 正文

MySql 5.7.17压缩包免安装的配置过程图解

2024-07-24 12:50:15
字体:
来源:转载
供稿:网友

MySQL数据库管理软件有两种版本,一种是企业版,一种是社区版,其中,前者是收费的,如果是个人使用的,社区版足矣。下载mysql-5.7.17-winx64.zip,并将之解压于自己选定的目录后,如图1,会在文件夹里看到配置文件my-default.ini,此时,需将其复制,并粘贴进bin文件夹里,并将其重新命名为my.ini,如图2。至此准备工作完成,下面将详说具体的配置过程。

图1
图2

工具/原料

(1)电脑:Lenovo B460e;
 (2)操作系统:windows 7,64位;
 (3)mysql-5.7.17-winx64.zip。

方法/步骤

(1)配置系统环境变量;1、添加新的系统环境变量MYSQL_HOME,值为:

 【C:/Program Files/MySQL/mysql-5.7.17-winx64】;

2、编辑系统环境变量path,添加如下代码(包括冒号“;”):【%MYSQL_HOME%/bin;】。

(2)根目录下的my-default.ini不动,配置bin文件夹中的my.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.[cilent]port=3306default_character_set=utf-8[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 = %MYSQL_HOME%datadir = %MYSQL_HOME%dataport = 3306server_id = 10default_character_set = utf-8max_connections = 200# 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 = 512Msort_buffer_size = 8Mread_rnd_buffer_size = 8M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

对my.ini配置文件的一些理解:

1.innodb_buffer_pool_size:个人建议设置为设置为操作系统内存的50%。如果设置过大,MySQL可能会 占用系统交换空间,导致系统变慢,从而降低查询效率;

2.basedir : 就是之前设置的环境变量;

3.server_id :关于主从复制的,应该是随便设, 但必须保持唯一;

4.datadir:后续初始化等数据都会保存在该文件下,该文件后续操作会自动建立;

5.port:连接数据库的端口号,3306即可,MySQL在线安装的默认就为3306;

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表