Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3692
  • 博文数量: 3
  • 博客积分: 85
  • 博客等级: 民兵
  • 技术积分: 45
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-04 20:16
文章分类
文章存档

2012年(3)

我的朋友

分类: Mysql/postgreSQL

2012-12-05 10:52:01


--------------------------------------------------------------------------------------------------
//参考配置
./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/var/ –with-server-suffix=-enterprise-gpl –without-debug –with-big-tables –with-extra-charsets=latin1,gb2312,big5,utf8,GBK –with-extra-charsets=all –with-pthread –enable-static –enable-thread-safe-client –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –with-plugins=innobase

./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
--------------------------------------------------------------------------------------------



(一)安装mysql数据库
1.解压 mysql-5.1.66.tar.gz
2. 进入解压的文件夹
============================  configure   ==========================
./configure \
--prefix=/home/xxxx/user/mysql5  \
--with-charset=gbk  \
--with-extra-charsets=gbk,utf8,ascii,big5,latin1,binary  \
--with-plugins=innobase \
--with-unix-socket-path=/home/xxxx/user/mysql5/tmp/mysql.sock
====================================================================
3. make
4. make install
5. cd mysql
(1)建立etc log tmp var  空文件夹
(2)在/etc下的建my.cnf 文件(注意:路径为当前环境的路径)
============
见下面
============
6. 进入/bin目录,生成mysql数据库和表文件
./mysql_install_db  --user=root
7.启动(或关闭mysql)
./mysqld_safe  & (./mysqladmin -uroot -p shutdown)
8.进入/bin目录,添加系统用户
./mysqladmin  -u root password 123
9.使用mysql 或 修改系统(或普通)用户密码
./mysql  -uroot  -p123
// Use mysql
// Update user set password= PASSWORD('123')  where user=’root’ ;
10.添加用户并授权
grant all privileges on 数据库.表名 to ‘用户’@’IP地址’ identified by ‘密码’;
grant all privileges on *.* to 'root'@'10.237.1.174' identified by '123';


========================= my.cnf  ===========================================

[client]
port                     = 3366
socket                   = /home/xxxx/user/mysql5/tmp/mysql.sock

[mysqld]
port                     = 3366
socket                   = /home/xxxx/user/mysql5/tmp/mysql.sock
pid-file                 = /home/xxxx/user/mysql5/var/mysql.pid
basedir                  = /home/xxxx/user/mysql5/
datadir                  = /home/xxxx/user/mysql5/var/

# tmp dir settings
tmpdir                   = /home/xxxx/user/mysql5/tmp/
slave-load-tmpdir        = /home/xxxx/user/mysql5/tmp/ 

# skip options 
skip-name-resolve
skip-symbolic-links
skip-external-locking
skip-slave-start

# res settings
back_log                 = 50
max_connections          = 1000
max_connect_errors       = 10000

connect-timeout          = 5
wait-timeout             = 28800
interactive-timeout      = 28800
slave-net-timeout        = 600
net_read_timeout         = 30
net_write_timeout        = 60
net_retry_count          = 10
net_buffer_length        = 16384
max_allowed_packet       = 64M

table_cache              = 512
thread_stack             = 192K
thread_cache_size        = 20
thread_concurrency       = 8

# qcache settings
query_cache_size         = 0
query_cache_limit        = 0
query_cache_min_res_unit = 0

# default settings
default-time-zone        = system
character-set-server     = gbk
default-storage-engine   = MyISAM

# tmp & heap 
tmp_table_size           = 512M
max_heap_table_size      = 512M

log-bin                  = mysql-bin
log-bin-index            = mysql-bin.index
relay-log                = relay-log
relay_log_index          = relay-log.index

# warning & error log
log-warnings             = 1
log-error                = /home/xxxx/user/mysql5/log/mysql.err

# slow query log
long-query-time          = 1
log-slow-queries         = /home/xxxx/user/mysql5/log/slow.log

#log-queries-not-using-indexes
log                      = /home/xxxx/user/mysql5/log/mysql.log
max_binlog_size          = 1G
max_relay_log_size       = 1G

# if use auto-ex, set to 0
relay-log-purge          = 1

# max binlog keeps days
expire_logs_days         = 0

binlog_cache_size        = 1M

# replication
replicate-wild-ignore-table     = mysql.%
replicate-wild-ignore-table     = test.%
# slave_skip_errors=all

key_buffer_size                 = 256M
sort_buffer_size                = 2M
read_buffer_size                = 2M
join_buffer_size                = 8M
read_rnd_buffer_size            = 8M
bulk_insert_buffer_size         = 64M
myisam_sort_buffer_size         = 64M
myisam_max_sort_file_size       = 10G
myisam_repair_threads           = 1
myisam_recover

transaction_isolation           = REPEATABLE-READ

innodb_file_per_table

#innodb_status_file             = 1
#innodb_open_files              = 2048
innodb_additional_mem_pool_size = 100M
innodb_buffer_pool_size         = 512M
innodb_data_home_dir            = /home/xxxx/user/mysql5/var/
innodb_data_file_path           = ibdata1:1G:autoextend
innodb_file_io_threads          = 4
innodb_thread_concurrency       = 16
innodb_flush_log_at_trx_commit  = 1

innodb_log_buffer_size          = 8M
innodb_log_file_size            = 1900M
innodb_log_files_in_group       = 2
innodb_log_group_home_dir       = /home/xxxx/user/mysql5/var/

innodb_max_dirty_pages_pct      = 90
innodb_lock_wait_timeout        = 100
#innodb_flush_method            = O_DSYNC

[mysqldump]
quick
max_allowed_packet              = 64M

[mysql]
disable-auto-rehash
default-character-set           = gbk
connect-timeout                 = 3

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M 
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


========================= my.cnf  ===========================================


点击(此处)折叠或打开

  1. --------------------------------------------------------------------------------------------------
  2. //参考配置
  3. ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/var/ –with-server-suffix=-enterprise-gpl –without-debug –with-big-tables –with-extra-charsets=latin1,gb2312,big5,utf8,GBK –with-extra-charsets=all –with-pthread –enable-static –enable-thread-safe-client –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –with-plugins=innobase

  4. ./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
  5. --------------------------------------------------------------------------------------------



  6. (一)安装mysql数据库
  7. 1.解压 mysql-5.1.66.tar.gz
  8. 2. 进入解压的文件夹
  9. ============================ configure ==========================
  10. ./configure \
  11. --prefix=/home/xxxx/user/mysql5 \
  12. --with-charset=gbk \
  13. --with-extra-charsets=gbk,utf8,ascii,big5,latin1,binary \
  14. --with-plugins=innobase \
  15. --with-unix-socket-path=/home/xxxx/user/mysql5/tmp/mysql.sock
  16. ====================================================================
  17. 3. make
  18. 4. make install
  19. 5. cd mysql
  20.     (1)建立etc log tmp var 空文件夹
  21.     (2)/etc下的建my.cnf 文件(注意:路径为当前环境的路径)    
  22.         ============
  23.             见下面
  24.         ============
  25. 6. 进入/bin目录,生成mysql数据库和表文件
  26.     ./mysql_install_db --user=root
  27. 7.启动(或关闭mysql)
  28.     ./mysqld_safe &        (./mysqladmin -uroot -p shutdown)
  29. 8.进入/bin目录,添加系统用户
  30.     ./mysqladmin -u root password 123
  31. 9.使用mysql 或 修改系统(或普通)用户密码
  32.     ./mysql -uroot -p123
  33.     // Use mysql
  34.     // Update user set password= PASSWORD('123') where user=’root’ ;
  35. 10.添加用户并授权
  36.     grant all privileges on 数据库.表名 to ‘用户’@’IP地址’ identified by ‘密码’;
  37.     grant all privileges on *.* to 'root'@'10.237.1.174' identified by '123';


  38. ========================= my.cnf ===========================================

  39. [client]
  40. port = 3366
  41. socket = /home/xxxx/user/mysql5/tmp/mysql.sock

  42. [mysqld]
  43. port = 3366
  44. socket = /home/xxxx/user/mysql5/tmp/mysql.sock
  45. pid-file = /home/xxxx/user/mysql5/var/mysql.pid
  46. basedir = /home/xxxx/user/mysql5/
  47. datadir = /home/xxxx/user/mysql5/var/

  48. # tmp dir settings
  49. tmpdir = /home/xxxx/user/mysql5/tmp/
  50. slave-load-tmpdir = /home/xxxx/user/mysql5/tmp/

  51. # skip options
  52. skip-name-resolve
  53. skip-symbolic-links
  54. skip-external-locking
  55. skip-slave-start

  56. # res settings
  57. back_log = 50
  58. max_connections = 1000
  59. max_connect_errors = 10000

  60. connect-timeout = 5
  61. wait-timeout = 28800
  62. interactive-timeout = 28800
  63. slave-net-timeout = 600
  64. net_read_timeout = 30
  65. net_write_timeout = 60
  66. net_retry_count = 10
  67. net_buffer_length = 16384
  68. max_allowed_packet = 64M

  69. #
  70. table_cache = 512
  71. thread_stack = 192K
  72. thread_cache_size = 20
  73. thread_concurrency = 8

  74. # qcache settings
  75. query_cache_size = 0
  76. query_cache_limit = 0
  77. query_cache_min_res_unit = 0

  78. # default settings
  79. default-time-zone = system
  80. character-set-server = gbk
  81. default-storage-engine = MyISAM

  82. # tmp & heap
  83. tmp_table_size = 512M
  84. max_heap_table_size = 512M

  85. log-bin = mysql-bin
  86. log-bin-index = mysql-bin.index
  87. relay-log = relay-log
  88. relay_log_index = relay-log.index

  89. # warning & error log
  90. log-warnings = 1
  91. log-error = /home/xxxx/user/mysql5/log/mysql.err

  92. # slow query log
  93. long-query-time = 1
  94. log-slow-queries = /home/xxxx/user/mysql5/log/slow.log

  95. #log-queries-not-using-indexes
  96. log = /home/xxxx/user/mysql5/log/mysql.log
  97. max_binlog_size = 1G
  98. max_relay_log_size = 1G

  99. # if use auto-ex, set to 0
  100. relay-log-purge = 1

  101. # max binlog keeps days
  102. expire_logs_days = 0

  103. binlog_cache_size = 1M

  104. # replication
  105. replicate-wild-ignore-table = mysql.%
  106. replicate-wild-ignore-table = test.%
  107. # slave_skip_errors=all

  108. key_buffer_size = 256M
  109. sort_buffer_size = 2M
  110. read_buffer_size = 2M
  111. join_buffer_size = 8M
  112. read_rnd_buffer_size = 8M
  113. bulk_insert_buffer_size = 64M
  114. myisam_sort_buffer_size = 64M
  115. myisam_max_sort_file_size = 10G
  116. myisam_repair_threads = 1
  117. myisam_recover

  118. transaction_isolation = REPEATABLE-READ

  119. innodb_file_per_table

  120. #innodb_status_file = 1
  121. #innodb_open_files = 2048
  122. innodb_additional_mem_pool_size = 100M
  123. innodb_buffer_pool_size = 512M
  124. innodb_data_home_dir = /home/xxxx/user/mysql5/var/
  125. innodb_data_file_path = ibdata1:1G:autoextend
  126. innodb_file_io_threads = 4
  127. innodb_thread_concurrency = 16
  128. innodb_flush_log_at_trx_commit = 1

  129. innodb_log_buffer_size = 8M
  130. innodb_log_file_size = 1900M
  131. innodb_log_files_in_group = 2
  132. innodb_log_group_home_dir = /home/xxxx/user/mysql5/var/

  133. innodb_max_dirty_pages_pct = 90
  134. innodb_lock_wait_timeout = 100
  135. #innodb_flush_method = O_DSYNC

  136. [mysqldump]
  137. quick
  138. max_allowed_packet = 64M

  139. [mysql]
  140. disable-auto-rehash
  141. default-character-set = gbk
  142. connect-timeout = 3

  143. [isamchk]
  144. key_buffer = 256M
  145. sort_buffer_size = 256M
  146. read_buffer = 2M
  147. write_buffer = 2M

  148. [myisamchk]
  149. key_buffer = 256M
  150. sort_buffer_size = 256M
  151. read_buffer = 2M
  152. write_buffer = 2M

  153. [mysqlhotcopy]
  154. interactive-timeout


  155. ========================= my.cnf ===========================================

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

上一篇:我的vimrc 配置

下一篇:linux mysql 相关操作

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