日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql my.ini my.cnf_Mysql配置文件my.ini/my.cnf

發(fā)布時間:2023/12/15 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql my.ini my.cnf_Mysql配置文件my.ini/my.cnf 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

●配置實(shí)例

在mysql的發(fā)布版本里的support-file目錄下通常會包含4個配置文件的樣例:

my-small.cnf

my-medium.cnf

my-large.cnf

my-huge.cnf

以上這些文件的名字就表示了該配置文件適用的服務(wù)器大小。在每一份樣例中

都有注釋說明了使用服務(wù)器的范圍。例如在my-medium.cnf文件中有;

# This is for a system with little memory (32M - 64M) where MySQL

plays

# a important part and systems up to 128M very MySQL is used

together with

# other programs (like a web server)

要使用樣例文件,簡單的拷貝帶/etc/my.cnf目錄下,再做一個必要的改動即可。因為

開始運(yùn)行一個新的mysql時都很難一次配置到完美,所以使用樣例文件作為系統(tǒng)最開始

的配置是比較合適的。但是在某些情況如果不對樣例配合作出一些必要的調(diào)整,那么

性能可能會十分糟糕。

還是以my-medium.cnf文件為例,對于一個剛剛安裝好的系統(tǒng),有一些信息還不能完全理解。

但是經(jīng)歷了更多的例子后,就會慢慢的理解。該文件開頭首先一些很有用的注釋信息,說明

該配置文件適合的系統(tǒng)種類,以及安裝所需要的信息:

# Example mysql config file for medium systems.

#

# This is for a system with little memory (32M - 64M) where MySQL

plays

# a important part and systems up to 128M very MySQL is used

together with

# other programs (like a web server)

#

# You can copy this file to

# /etc/mf.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options (in

this

# installation this directory is /usr/local/mysq/var)

or

# ~/.my.cnf to set user-specific options.

#

# One can in this file use all long options that the program

supports.

# If you want to know which options a program support, run the

program

# with --help option.

下面是所有客戶端工具都會使用的配置項:

# The following options will be passed to all MySQL

clients

[client]

#password = your_password

port = 3306

socket = /tmp/mysql.sock

下面是服務(wù)端所使用的各種配置項。端口和socket選項需要與前面的客戶端選項保持一致。

其余的一些選項設(shè)置為了各種緩存分配的內(nèi)存大小,以及復(fù)制所需的配置。

# Here follows entries for some specific programs

# The MySQL server

[mysqld]

port = 3306

socket = /tmp/mysql.sock

skip-locking

set-variable = key_buffer=16M

set-variable = max_allowed_packet=1M

set-variable = table_cache=64

set-variable = sort_buffer=512K

set-variable = net_buffer_length=8K

set-variable = myisam_sort_buffer_size=8M

log-bin

server-id = 1

下面的選項如果有足夠磁盤空間的話,可能就不需要改動:

# Point the following paths to different dedicated

disks

#tmpdir = /tmp/

#log-update =

/path-to-dedicated-directory/hostname

BDB選項是專門針對BDB存儲引擎的。BDB引擎是mysql第一個支持事務(wù)安全的引擎。在第二章將

專門介紹存儲引擎。

# Uncomment the following if you are using BDB

tables

#set-variable = bdb_cache_size=4M

#set-variable = bdb_max_lock=10000

InnoDB,是另一種mysql存儲引擎,要使用它必須要預(yù)先設(shè)置好一些配置項。因為InnoDB使用

它自身的內(nèi)存管理和存儲系統(tǒng)來提供事務(wù)安全的數(shù)據(jù)表,所以必須設(shè)置數(shù)據(jù)文件的格式,以及

分配的內(nèi)存大小。(InnoDB是Innobase的簡寫,所以在配置文件里面看到的是Innobase)

# Uncomment the following if you are using Innobase

tables

#innodb_data_file_path = ibdata1:400M

#innodb_data_home_dir = /usr/local/mysql/var/

#innodb_log_group_home_dir = /usr/local/mysql/var/

#innodb_log_arch_dir = /usr/local/mysql/var/

#set-variable = innodb_mirrored_log_groups=1

#set-variable = innodb_log_files_in_group=3

#set-variable = innodb_log_file_size=5M

#set-variable = innodb_log_buffer_size=8M

#innodb_flush_log_at_trx_commit=1

#innodb_log_archive=0

#set-variable = innodb_buffer_pool_size=16M

#set-variable = innodb_additional_mem_pool_size=2M

#set-variable = innodb_file_io_threads=4

#set-variable = innodb_lock_wait_timeout=50

最后介紹的一組配置是關(guān)于mysql的命令行工具,包括mysql的shell:

[mysqldump]

quick

set-variable = max_allowed_packet=16M

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with

SQL

#safe-updates

[isamchk]

set-variable = key_buffer=20M

set-variable = sort_buffer=20M

set-variable = read_buffer=2M

set-variable = write_buffer=2M

[myisamchk]

set-variable = key_buffer=20M

set-variable = sort_buffer=20M

set-variable = read_buffer=2M

set-variable = write_buffer=2M

[mysqlhotcopy]

interactive-timeout

假如把所有可能的配置項都列出來的話,那么篇幅實(shí)在太大了。90%以上的mysql使用者幾乎沒有必要了解那些在樣例配置文件之外的那些配置項。

總結(jié)

以上是生活随笔為你收集整理的mysql my.ini my.cnf_Mysql配置文件my.ini/my.cnf的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。