Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239956
  • 博文数量: 49
  • 博客积分: 246
  • 博客等级: 二等列兵
  • 技术积分: 1034
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-02 13:18
文章分类

全部博文(49)

分类: Mysql/postgreSQL

2013-01-10 16:13:04

1. 安装
  1. useradd mysql
  2. yum install gcc gcc-c++ autoconf automake ncurses ncurses-devel wget vim cmake
  3. wget
  4. tar zxvf mysql-5.5.28.tar.gz
  5. cd $(echo mysql-5.5.28.tar.gz |awk '{gsub(".tar.gz","")}{print}')
  6. cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/data/mysql/data -DMYSQL_UNIX_ADDR=/data/mysql/data//mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/data/mysql/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
    make;make install
    export PATH=$PATH:/usr/local/mysql/bin
    echo export PATH=$PATH:/usr/local/mysql/bin >> /etc/profile
    source /etc/profile
    /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/data


2. my.cnf

点击(此处)折叠或打开

  1. #MYSQL 5.5
  2. [client]
  3. port = 3306
  4. socket = /data/mysql/data/mysql.sock
  5. character-sets-dir=utf8
  6. [mysqld]
  7. server-id = 1
  8. user = mysql
  9. port = 3306
  10. socket = /data/mysql/data/mysql.sock
  11. basedir = /usr/local/mysql
  12. datadir = /data/mysql/data
  13. character-set-server=utf8
  14. pid-file = /data/mysql/mysql.pid
  15. default-storage-engine=INNODB
  16. #lower_case_table_names=1 #查询表不区分大小写
  17. log-error = /data/mysql/data/mysql.log
  18. open_files_limit = 10240
  19. back_log = 600
  20. max_connections = 8000
  21. max_connect_errors = 6000
  22. table_cache = 1024
  23. external-locking = FALSE
  24. max_allowed_packet = 32M
  25. sort_buffer_size = 1M
  26. join_buffer_size = 1M
  27. thread_cache_size = 300
  28. thread_concurrency = 8
  29. query_cache_size = 512M
  30. query_cache_limit = 2M
  31. query_cache_min_res_unit = 2k
  32. thread_stack = 192K
  33. transaction_isolation = READ-COMMITTED
  34. tmp_table_size = 512M
  35. max_heap_table_size = 512M
  36. long_query_time = 3
  37. #log-slave-updates
  38. log-bin = /data/mysql/binlog
  39. binlog_cache_size = 4M
  40. binlog_format = MIXED
  41. max_binlog_cache_size = 8M
  42. max_binlog_size = 1G
  43. relay-log-index = /data/mysql/relaylog
  44. relay-log-info-file = /data/mysql/relaylog
  45. relay-log = /data/mysql/relaylog
  46. key_buffer_size = 256M
  47. read_buffer_size = 1M
  48. read_rnd_buffer_size = 16M
  49. bulk_insert_buffer_size = 64M
  50. myisam_sort_buffer_size = 128M
  51. myisam_max_sort_file_size = 10G
  52. myisam_repair_threads = 1
  53. myisam_recover
  54. # *** Replication related settings
  55. #server-id = 111
  56. #master-host = 192.168.1.252
  57. #master-user = repl
  58. #master-password = slave
  59. #master-port = 3310
  60. #skip-slave-start = 1
  61. #replicate-ignore-db = information_schema,mysql,m4n,m4n_group,vgift,m4n_backup
  62. #replicate-do-db = m4n
  63. #replicate-do-db = m4n_group
  64. #replicate-do-db = vgift
  65. #replicate-do-db = m4n_backup
  66. #replicate-do-db = db
  67. #replicate-wild-ignore-table=
  68. #read_only
  69. #interactive_timeout = 120
  70. wait_timeout = 120
  71. expire_logs_days = 7
  72. #skip-name-resolve
  73. #master-connect-retry = 10
  74. #slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
  75. innodb_additional_mem_pool_size = 16M
  76. #innodb_buffer_pool_size = 4G
  77. innodb_buffer_pool_size = 512M
  78. #innodb_data_file_path = ibdata1:2G:autoextend
  79. innodb_data_file_path = ibdata1:256M:autoextend
  80. innodb_file_io_threads = 4
  81. innodb_thread_concurrency = 8
  82. innodb_flush_log_at_trx_commit = 2
  83. innodb_log_buffer_size = 16M
  84. innodb_log_file_size = 128M
  85. innodb_log_files_in_group = 3
  86. innodb_max_dirty_pages_pct = 90
  87. innodb_lock_wait_timeout = 120
  88. innodb_file_per_table = 0
  89. #log-slow-queries = /data0/mysql/3306/slow.log
  90. ##long_query_time = 10
  91. [mysqldump]
  92. quick
  93. max_allowed_packet = 128M
  94. default-character-set=utf8
  95. [mysql]
  96. no-auto-rehash
  97. prompt=mysql [\\d]>\\_
  98. max_allowed_packet = 512M
  99. default-character-set=utf8
3.启动
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
/usr/local/mysql/bin/mysqld_safe --user=mysql &

阅读(2063) | 评论(0) | 转发(0) |
0

上一篇:nginx rewrite

下一篇:Nginx upstream

给主人留下些什么吧!~~