mysql怎么整理 mysql整理碎片( 二 )


--no-version-check
不检查版本,在阿里云服务器中一般加入此参数,否则会报错
mysql耗内存吗?应该怎么处理?mysql耗内存吗?很多人都说MySQL占用了很大的虚拟内存 , 那么这个问题应该怎么解决呢?下面是我收集整理的一些方法,现在分享给大家!
解决mysql耗内存的具体方法一:
在分析的过程中发现最耗内存的是MySQL,其中近1GB的内存被它吞了 , 而且不在任务管理器体现出来 。这个数据库软件是EMS要用到了,所以必须要运行 。这个软件在安装的时候会根据机器的实际内存自动进行配置,PC机物理内存越多,它默认占有的内存就越多,难怪3GB的内存被它给吞了近1GB 。
优化方法:
1. 退出EMS clientserver
2. 在CMD里运行:net stop mysql
3. 找到MySQL\MySQL Server的安装目录 , 里面有个my.ini文件,参考附件的配置对参数query_cache_size tmp_table_size myisam_sort_buffer_size key_buffer_size innodb_buffer_pool_size进行修改,注意不要改动innodb_log_file_size,修改前备份my.ini
4. 在CMD里运行:net start mysql,如果提示成功 , 则说明修改的参数没有什么问题,如果失败,重新调整一下上面的参数
5. 找到EMS 安装目录runGUI.bat runServer.bat脚本,找到-Xmx700m,改为-Xmx256m , 注意修改前备份这两个文件,感谢Liping Sun提供帮助
6. 重新运行EMS
前后对比,对于3GB的PC,发现可以节省近1GB的内存 。对于2GB的PC,也可以节省600-800MB 。优化后发现EMS启动稍微慢一些,但是其它的软件运行速度提高了很多,不在经常出现卡机现象了 。如果在运行过程中发现EMS特别慢的话,自己也可以适当放大上面提到的一些参数 。
my.ini
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to

推荐阅读