免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3115 | 回复: 6
打印 上一主题 下一主题

为什么我设置的key_buffer_size 为0? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-26 10:29 |只看该作者 |倒序浏览
mysql> show variables like 'key_%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| key_buffer_size          | 0     |
| key_cache_age_threshold  | 0     |
| key_cache_block_size     | 0     |
| key_cache_division_limit | 0     |
+--------------------------+-------+
4 rows in set (0.00 sec)

为什么我设置的key_buffer_size 为0???????????????

但是 mysqld --help --verbose中显示确实正常的 怎么回事呢??
  1.   
  2. mysql> show variables like 'key_buffer_size';
  3. +-----------------+-------+
  4. | Variable_name   | Value |
  5. +-----------------+-------+
  6. | key_buffer_size | 0     |
  7. +-----------------+-------+
  8. 1 row in set (0.00 sec)

复制代码

  1.   
  2. mysqld --help --verbose
  3. key_buffer_size                   402653184
  4. key_cache_block_size              1024
  5. key_cache_division_limit          100
复制代码




手工设置 可以

SET GLOBAL key_buffer_size=402653184
| key_buffer_size                 | 402653184

  1.   

  2. /opt/mysql> more .my.cnf
  3. # Example mysql config file for large systems.
  4. #
  5. # This is for large system with memory = 512M where the system runs mainly
  6. # MySQL.
  7. #
  8. # You can copy this file to
  9. # /etc/my.cnf to set global options,
  10. # mysql-data-dir/my.cnf to set server-specific options (in this
  11. # installation this directory is /opt/dc_mysql/var) or
  12. # ~/.my.cnf to set user-specific options.
  13. #
  14. # One can in this file use all long options that the program supports.
  15. # If you want to know which options a program supports, run the program
  16. # with the --help option.

  17. # The following options will be passed to all MySQL clients
  18. [client]
  19. password        = root
  20. user           = root
  21. port            = 3306
  22. socket          = /opt/mysql/var/mysql.sock

  23. # Here follows entries for some specific programs

  24. # The MySQL server
  25. [mysqld]
  26. port            = 3306
  27. socket          = /opt/mysql/var/mysql.sock
  28. skip-locking
  29. back_log = 100
  30. key_buffer_size = 384M
  31. max_allowed_packet = 2M
  32. table_cache = 1024
  33. sort_buffer_size = 2M
  34. read_buffer_size = 2M
  35. read_rnd_buffer_size = 8M
  36. myisam_sort_buffer_size = 64M
  37. thread_cache = 8
  38. query_cache_size= 32M
  39. max_connections = 500
  40. open_files_limit = 4096
  41. wait_timeout = 28800

  42. skip-name-resolv

  43. # Try number of CPU's*2 for thread_concurrency
  44. thread_concurrency = 8

  45. # Don't listen on a TCP/IP port at all. This can be a security enhancement,
  46. # if all processes that need to connect to mysqld run on the same host.
  47. # All interaction with mysqld must be made via Unix sockets or named pipes.
  48. # Note that using this option without enabling named pipes on Windows
  49. # (via the "enable-named-pipe" option) will render mysqld useless!
  50. #
  51. #skip-networking

  52. # Replication Master Server (default)
  53. # binary logging is required for replication
  54. log-bin

  55. # required unique id between 1 and 2^32 - 1
  56. # defaults to 1 if master-host is not set
  57. # but will not function as a master if omitted
  58. server-id       = 1

  59. # Replication Slave (comment out master section to use this)
  60. #
  61. # To configure this host as a replication slave, you can choose between
  62. # two methods :
  63. #
  64. # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
  65. #    the syntax is:
  66. #
  67. #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
  68. #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
  69. #
  70. #    where you replace <host>, <user>, <password> by quoted strings and
  71. #    <port> by the master's port number (3306 by default).
  72. #
  73. #    Example:
  74. #
  75. #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
  76. #    MASTER_USER='joe', MASTER_PASSWORD='secret';
  77. #
  78. # OR
  79. #
  80. # 2) Set the variables below. However, in case you choose this method, then
  81. #    start replication for the first time (even unsuccessfully, for example
  82. #    if you mistyped the password in master-password and the slave fails to
  83. #    connect), the slave will create a master.info file, and any later
  84. #    change in this file to the variables' values below will be ignored and
  85. #    overridden by the content of the master.info file, unless you shutdown
  86. #    the slave server, delete master.info and restart the slaver server.
  87. #    For that reason, you may want to leave the lines below untouched
  88. #    (commented) and instead use CHANGE MASTER TO (see above)
  89. #
  90. # required unique id between 2 and 2^32 - 1
  91. # (and different from the master)
  92. # defaults to 2 if master-host is set
  93. # but will not function as a slave if omitted
  94. #server-id       = 2
  95. #
  96. # The replication master for this slave - required
  97. #master-host     =   <hostname>
  98. #
  99. # The username the slave will use for authentication when connecting
  100. # to the master - required
  101. #master-user     =   <username>
  102. #
  103. # The password the slave will authenticate with when connecting to
  104. # the master - required
  105. #master-password =   <password>
  106. #
  107. # The port the master is listening on.
  108. # optional - defaults to 3306
  109. #master-port     =  <port>
  110. #
  111. # binary logging - not required for slaves, but recommended
  112. #log-bin

  113. # Point the following paths to different dedicated disks
  114. #tmpdir         = /tmp/         
  115. #log-update     = /path-to-dedicated-directory/hostname

  116. # Uncomment the following if you are using BDB tables
  117. #bdb_cache_size = 64M
  118. #bdb_max_lock = 100000

  119. # Uncomment the following if you are using InnoDB tables
  120. #innodb_data_home_dir = /opt/dc_mysql/var/
  121. #innodb_data_file_path = ibdata1:10M:autoextend
  122. #innodb_log_group_home_dir = /opt/dc_mysql/var/
  123. #innodb_log_arch_dir = /opt/dc_mysql/var/
  124. # You can set .._buffer_pool_size up to 50 - 80 %
  125. # of RAM but beware of setting memory usage too high
  126. #innodb_buffer_pool_size = 256M
  127. #innodb_additional_mem_pool_size = 20M
  128. # Set .._log_file_size to 25 % of buffer pool size
  129. #innodb_log_file_size = 64M
  130. #innodb_log_buffer_size = 8M
  131. #innodb_flush_log_at_trx_commit = 1
  132. #innodb_lock_wait_timeout = 50

  133. [mysqldump]
  134. quick
  135. max_allowed_packet = 16M

  136. [mysql]
  137. no-auto-rehash
  138. # Remove the next comment character if you are not familiar with SQL
  139. #safe-updates

  140. [isamchk]
  141. key_buffer = 256M
  142. sort_buffer_size = 256M
  143. read_buffer = 2M
  144. write_buffer = 2M

  145. [myisamchk]
  146. key_buffer = 256M
  147. sort_buffer_size = 256M
  148. read_buffer = 2M
  149. write_buffer = 2M

  150. [mysqlhotcopy]
  151. interactive-timeout

复制代码

[ 本帖最后由 aaronvox 于 2006-7-26 15:33 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-07-26 11:58 |只看该作者
原帖由 aaronvox 于 2006-7-26 10:29 发表
mysql> show variables like 'key_%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| key_buffer_size          | 0     |
| key ...


因为你没设置

论坛徽章:
0
3 [报告]
发表于 2006-07-26 15:04 |只看该作者
原帖由 yejr 于 2006-7-26 11:58 发表
因为你没设置


请问我需要在哪里设置
非常感谢

论坛徽章:
0
4 [报告]
发表于 2006-07-26 15:08 |只看该作者
我的wait_timeout = 9 就是不成功,很奇怪

论坛徽章:
0
5 [报告]
发表于 2006-07-26 15:14 |只看该作者
参见 SET 语法,http://imysql.cn/?q=node/13

论坛徽章:
0
6 [报告]
发表于 2006-07-26 15:25 |只看该作者
原帖由 yejr 于 2006-7-26 15:14 发表
参见 SET 语法,http://imysql.cn/?q=node/13


我只是想设置全局变量 而不是session的 所以想配置文件配置好久ok

可是这个参数始终就不能成功显示出来

我设置的max_connections =500 都成功了

我的内存是8G 所以大点可以



手工设置 可以

SET GLOBAL key_buffer_size=402653184
| key_buffer_size                 | 402653184

[ 本帖最后由 aaronvox 于 2006-7-26 15:33 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2006-07-27 09:15 |只看该作者
你怎么修改配置文件的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP