久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

mysql占用資源過大如何解決

156次閱讀
沒有評論

共計 2342 個字符,預計需要花費 6 分鐘才能閱讀完成。

mysql 占用資源過大如何解決,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

  在 linux 下,經常出現的情況就是使用 VBB 這種系統時,出現緩慢,假死狀態,sleep 進程過多等等現像。導致幾十個用戶,就把系統搞定了。
  其實這是 mysql 配置上的問題,默認的 linux 中,mysql 的配置是 my-large.cnf 配置,該配置適合大型服務器。有高內存,比如 2G,4G 內存的,適合使用,而一般 512M 內存 的就不行了。它會占用 512M 內存來保存系統 mysql 的進程,這些進程長期堆質,并不釋放,導致系統緩慢。所以,把配置改變成為 my-small.cnf,小型配置就可以了。它的配置如下:
  # Example mysql config file for small systems.
  #
  # This is for a system with little memory (= 64M) where MySQL is only used
  # from time to time and its important that the mysqld deamon
  # doesnt use much resources.
  #
  # You can copy this file to
  # /etc/my.cnf to set global options,
  # mysql-data-dir/my.cnf to set server-specific options (in this
  # installation this directory is /var/lib/mysql) or
  # ~/.my.cnf to set user-specific options.
  #
  # One can in this file use all long options that the program supports.
  # If you want to know which options a program support, run the program
  # with –help option.
  # The following options will be passed to all MySQL clients
  [client]
  #password = 你的密碼
  port = 3306
  socket = /tmp/mysql.sock
  # Here follows entries for some specific programs
  # The MySQL server
  [mysqld]
  port = 3306
  socket = /tmp/mysql.sock
  skip-locking
  set-variable = key_buffer=16K
  set-variable = max_allowed_packet=1M
  set-variable = thread_stack=64K
  set-variable = table_cache=4
  set-variable = sort_buffer=64K
  set-variable = net_buffer_length=2K
  server-id = 1
  # Uncomment the following if you want to log updates
  #log-bin
  # Uncomment the following if you are NOT using BDB tables
  #skip-bdb
  # Uncomment the following if you are using InnoDB tables
  #innodb_data_home_dir = /var/lib/mysql/
  #innodb_data_file_path = ibdata1:10M:autoextend
  #innodb_log_group_home_dir = /var/lib/mysql/
  #innodb_log_arch_dir = /var/lib/mysql/
  # You can set .._buffer_pool_size up to 50 – 80 %
  # of RAM but beware of setting memory usage too high
  #set-variable = innodb_buffer_pool_size=16M
  #set-variable = innodb_additional_mem_pool_size=2M
  # Set .._log_file_size to 25 % of buffer pool size
  #set-variable = innodb_log_file_size=5M
  #set-variable = innodb_log_buffer_size=8M
  #innodb_flush_log_at_trx_commit=1
  #set-variable = innodb_lock_wait_timeout=50
  [mysqldump]
  quick
  set-variable = max_allowed_packet=16M
  [mysql]
  no-auto-rehash
  # Remove the next comment character if you are not familiar with SQL
  #safe-updates
  [isamchk]
  set-variable = key_buffer=8M
  set-variable = sort_buffer=8M
  [myisamchk]
  set-variable = key_buffer=8M
  set-variable = sort_buffer=8M
  [mysqlhotcopy]
  interactive-timeout

關于 mysql 占用資源過大如何解決問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注丸趣 TV 行業資訊頻道了解更多相關知識。

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-03發表,共計2342字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 齐河县| 聂拉木县| 辽阳县| 富宁县| 中宁县| 桦川县| 望城县| 建水县| 铁力市| 诸城市| 远安县| 三原县| 呼和浩特市| 高碑店市| 新泰市| 瓦房店市| 西贡区| 辽阳县| 乌海市| 宾川县| 临潭县| 修武县| 安康市| 桃园县| 富裕县| 遂昌县| 六安市| 武川县| 卓资县| 辰溪县| 兰溪市| 四子王旗| 咸阳市| 剑川县| 定结县| 合水县| 西城区| 泸溪县| 龙江县| 西华县| 衡山县|