在RHEL /Centos Linux操作系统上,输入yum命令安装mysql数据库服务器。
# yum install mysql mysql-server优化mysql服务器,否则它会吃掉你所有的CPU和其他资源
编辑 /etc/my.cnf , 请参考以下优化配置:
# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0 ## Go faster and skip some stuff, YMMVskip-name-resolveskip-slave-startskip-external-locking # PER CLIENT SETTINGS ## bit high but I got tons of ram here #sort_buffer_size = 2Mread_buffer_size = 2Mbinlog_cache_size = 1Mwait_timeout = 200interactive_timeout = 300max_allowed_packet = 12Mthread_stack = 128Ktable_cache = 1024myisam_sort_buffer_size = 1Mtmp_table_size = 12Mmax_heap_table_size = 12M # LOGGING #log_queries_not_using_indexes = 1slow_query_log = 1slow_query_log_file = /var/lib/mysql/slowquery.log # CACHES AND LIMITS #tmp_table_size = 12Mmax_heap_table_size = 12Mquery_cache_type = 1query_cache_limit = 2Mquery_cache_size = 32Mmax_connections = 500thread_cache_size = 50open_files_limit = 65535table_definition_cache = 4096table_open_cache = 1024 # MyISAM #key_buffer_size = 32Mmyisam_recover = FORCE,BACKUP # SAFETY #max_allowed_packet = 16Mmax_connect_errors = 1000000 # BINARY LOGGING #log_bin = /var/lib/mysql/mysql-binexpire_logs_days = 14sync_binlog = 1 # INNODB #innodb_flush_method = O_DIRECTinnodb_log_files_in_group = 2innodb_log_file_size = 256Minnodb_flush_log_at_trx_commit = 1innodb_file_per_table = 1innodb_buffer_pool_size = 10G保存并关闭该文件
重启/重新加载mysql服务器:
# chkconfig mysqld on# service mysqld start# service mysqld reload# service mysqld restart验证mysqld运行在tcp端口#3306上:
# netstat -tulpn | grep:3306
| 留言与评论(共有 0 条评论) “” |