服务器配置信息:
OS 名称: Microsoft(R) Windows(R) Server 2003, Enterprise Edition
OS 版本: 5.2.3790 Service Pack 2 Build 3790
OS 配置: 独立服务器
处理器: 8核 x86 Family 6 Model 58 Stepping 9 GenuineIntel ~3300 Mhz
物理内存总量: 16G
MySQL版本:5.6.12
PHP网站(小型):1000个
MySQL数据库:1000个
本来是使用Mysql5.1版本的,但经常会当掉,后面到官网一看,才知道那是5.1的一个BUG,现已升级至5.6版本,已经稳定运行。
但是,网站打开的速度挺慢的。
我是安装wamp,Mysql使用默认配置(基本没有性能优化)
现在想对mysql进行性能优化,请问,my.ini中的各个参数该如何调整呢?
或者主要调节哪几个参数,效果最好?
以下是我的my.ini配置:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[wampmysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=d:/wamp/bin/mysql/mysql5.6.12
log-error=d:/wamp/logs/mysql.log
datadir=d:/wamp/bin/mysql/mysql5.6.12/data
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Disable Federated by default
skip-federated
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
#server-id = 2
#master-host = <hostname>
#master-user = <username>
#master-password = <password>
#master-port = <port>
#log-bin=mysql-bin
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:\mysql\data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:\mysql\data/
#innodb_log_arch_dir = C:\mysql\data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld]
port=3306
#以下2个参数,是我自己调的,不然会报错:too many connections
max_connections=2000
wait_timeout=60
当然问题就出在你直接用xamp上面啊。
你还是一个一个单独安装吧,我之前一个站点偷懒使用了xampp,有十几个人访问根本就不能用,后面换成独立安装的apache mysql php代码一行没动。性能就上来了。