更新了我的 WAMP 服务器,MySQL 占用了 580mB 的内存

Jon*_*Jon 6 memory mysql wamp

我更新了我的开发箱的 WAMPSERVER,随着 PHP 和 Apache 的更新,MySQL 更新到了“5.6.12”。这样做之后,我将数据文件夹从旧的 (5.1.36) 安装复制到新的,现在 MySQL 占用了 580mB,这太多了,因为我是唯一一个使用它的人(本地)并且只有上面有 20 个左右的数据库,其中没有一个有“内存”表。

我怎样才能把它降到一个合适的数量?

我的.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 = .....
# datadir = .....
# port = .....
# 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 
Run Code Online (Sandbox Code Playgroud)

数据库信息:

Storage Engine  Data Size   Index Size  Total Size  
InnoDB           48.00 KB             0.00  B            48.00 KB
MEMORY            0.00  B             0.00  B             0.00  B
MyISAM          163.64 MB           122.49 MB           286.13 MB
Total           163.69 MB           122.49 MB           286.18 MB
Run Code Online (Sandbox Code Playgroud)

MTM*_*MTM 5

我将只展开“Kolerts”答案:首先检查您正在运行的 mysql 版本,鼠标右键单击系统托盘上的 wamp 图标,将鼠标悬停在 mysql >> 然后在版本菜单上,您将找到所选版本的它,按照类似wamp/bin/mysql/mysql5.6.xx(所选版本)的路径,编辑my.ini文件。

找到标签 [mysqld](通常在文件末尾)并粘贴以下内容:

table_definition_cache = 400
Run Code Online (Sandbox Code Playgroud)

通常默认包不设置此属性。并且 mysql 使用默认值 2000,这就是您的资源完全被它消耗的原因。如果它在那里但价值很高,那么只需将其减少到 400。这个值对于单个或两个用户来说是可以的,对于轻型用途但对于大量数据等,您需要适当调整它们。

保存文件并重新启动 mysql 服务或可能是所有服务都遵循新的更改。

现在打开你的任务管理器,找到 mysqld 进程让你脸上露出笑容:)。


小智 2

您可以在my.ini中设置“table_definition_cache = 400”并重新启动mysqld