Home Database Mysql Tutorial mysql配置文件例子_MySQL

mysql配置文件例子_MySQL

Jun 01, 2016 pm 01:29 PM
mysql Configuration file

bitsCN.com

mysql配置文件例子

 

[mysqld] 

port        = 3306

socket        = /tmp/mysql.sock

# 设置mysql的安装目录 

basedir=D://mysql-5.6.14-win32

# 设置mysql数据库的数据的存放目录,必须是data

datadir=D://mysql-5.6.14-win32//data

#innodb_log_arch_dir 默认datadir

#innodb_log_group_home_dir  默认datadir

# 设置mysql服务器的字符集,默认编码

default-character-set=utf8

 

#连接数的操作系统监听队列数量,如果经常出现“拒绝连接”错误可适当增加此值

back_log = 50

#不使用接听TCP / IP端口方法,mysqld通过命名管道连接

#skip-networking

# 最大连接数量

max_connections = 100

#打开表的线程数量限定,最大4096,除非用mysqld_safe打开限制

table_open_cache = 2048

#MySql 服务接收针对每个进程最大查询包大小

max_allowed_packet = 16M

#作用于SQL查询单笔处理使用的内存缓存,如果一笔操作的二进制数据超过了限定大小,将会在磁盘上开辟空间处理,一般设为 1-2M即可,默认1M

binlog_cache_size = 2M

#单个内存表的最大值限定

max_heap_table_size = 64M

#为每个线程分配的排序缓冲大小

sort_buffer_size = 8M

#join 连表操作的缓冲大小,根据实际业务来设置,默认8M

join_buffer_size = 32M

#操作多少个离开连接的线程的缓存

thread_cache_size = 8

#并发线程数量,默认为8,可适当增加到2倍以内。如果有多个CPU可以乘 上CPU的数量。双核CPU可以乘 上当前最核数再乘 上70%-85%

thread_concurrency = 16

#专用于具体SQL的缓存,如果提交的查询与几次中的某查询相同,并且在query缓存中存在,则直接返回缓存中的结果。

query_cache_size = 64M

#对应上一条设置,当查询的结果超过下面设置的大小时,将不会趣入到上面设置的缓存区中,避免了一个大的结果占据大量缓存。

query_cache_limit = 2M

#设置加全文检索中的最小单词长度。

#ft_min_word_len = 4

#CREATE TABLE 语句的默认表类型,如果不自己指定类型,则使用下行的类型

default-storage-engine = InnoDB

#线程堆栈大小,mysql说它自己用的堆栈大小不超过64K。这个值可适当设高一点(在我的项目中都是共用同一个数据库连接的),默认192K

thread_stack = 800K

#设置事务处理的级别,默认 REPEATABLE-READ,一般用它就即可,以下二行按顺序对应,

#可读写未提交的数据,创建未提交的数据副本读写,未提交之前可读不可写,只允许串行序列招行事务。

# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE

transaction_isolation = REPEATABLE-READ

#单一内存临时表在内存中的大小,超过此值自动转换到磁盘操作

tmp_table_size = 64M

#启动二进制日志功能,可通过它实现时间点恢复最新的备份

#log-bin=mysql-bin

#二进制日志格式,对就上一条,-建议混合格式

#binlog_format=mixed

#转换查询为缓慢查询

slow_query_log

#对应上一条,如果一个查询超过了下条设定的时间则执行上一条。

long_query_time = 2

#自定义主机ID识别符,用于主从或多服务器之间识别,为 一个 int 类型

server-id = 1

#一般用来缓存MyISAM表的主键,也用于临时的磁盘表缓存主键,上面多次出现临时磁盘表,所以就算不用MyISAM也最好为其设置一个不小的值,默认32M

key_buffer_size = 64M

#全表扫描MyISAM表时的缓存,每个线程拥有下行的大小。

read_buffer_size = 2M

#排序操作时与磁盘之间的缓存,分到每个线程,默认16M

read_rnd_buffer_size = 24M

#MyISAM使用特殊树形进行批量插入时的缓存,如insert ... values(..)(..)(..)

bulk_insert_buffer_size = 64M

#MyISAM索引文件的最大限定,

myisam_max_sort_file_size = 10G

#如果一个myisam表有一个以上的索引, MyISAM可以使用一个以上线程来排序并行它们。较耗硬件资源,如果你的环境不错,可以增加此值。

myisam_repair_threads = 2

#自动检查和修复无法正确关闭MyISAM表。

myisam_recover

# *** INNODB Specific options ***

#开启下条将会禁用 INNODB

#skip-innodb

#一般不用设置或者说设了也没多大用,InnoDB会自己与操作系统交互管理其附加内存池所使用InnoDB的存储数据的大小

innodb_additional_mem_pool_size = 16M

#innodb整体缓冲池大小,不宜过大,设为本地内存的 50%-75% 比较合适,在本机开发过程中可以设得较小一点如 200M

innodb_buffer_pool_size = 200M

#InnoDB的数据存储在一个或多个数据文件组成的表空间

innodb_data_file_path = ibdata1:10M:autoextend

#用于异步IO操作的线程数量,默认为 4 ,可适当提高

innodb_file_io_threads = 8

#线程数内允许的InnoDB内核,不宜太高

innodb_thread_concurrency = 16

#InnoDB的事务日志快存行为,默认为 1,为0可减轻磁盘I/0操作,还有以为2

innodb_flush_log_at_trx_commit = 1

#InnoDB的用于的缓冲日志数据的大小

innodb_log_buffer_size = 8M

#日志文件,可设置为25%-90%的总体缓存大小,默认 256M. 修改此项要先删除datadir/ib_logfileXXX 

innodb_log_file_size = 256M

#日志组数量,默认为3

innodb_log_files_in_group = 3

#InnoDB的日志文件位置。默认是MySQL的datadir

#innodb_log_group_home_dir

#InnoDB最大允许的脏页缓冲池的百分比,默认90

innodb_max_dirty_pages_pct = 80

#事务死锁超时设定

innodb_lock_wait_timeout = 120

 

[client]

port        = 3306

socket        = /tmp/mysql.sock

# 设置mysql客户端的字符集

default-character-set=utf8

 

[mysqldump]

quick

max_allowed_packet = 16M

 

[mysql]

no-auto-rehash

 

# Only allow UPDATEs and DELETEs that use keys.

#safe-updates

 

[WinMySQLAdmin] 

# 指定mysql服务启动启动的文件

Server=D://mysql-5.6.14-win32//bin//mysqld.exe 

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

Do mysql need to pay Do mysql need to pay Apr 08, 2025 pm 05:36 PM

MySQL has a free community version and a paid enterprise version. The community version can be used and modified for free, but the support is limited and is suitable for applications with low stability requirements and strong technical capabilities. The Enterprise Edition provides comprehensive commercial support for applications that require a stable, reliable, high-performance database and willing to pay for support. Factors considered when choosing a version include application criticality, budgeting, and technical skills. There is no perfect option, only the most suitable option, and you need to choose carefully according to the specific situation.

RDS MySQL integration with Redshift zero ETL RDS MySQL integration with Redshift zero ETL Apr 08, 2025 pm 07:06 PM

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

How to fill in mysql username and password How to fill in mysql username and password Apr 08, 2025 pm 07:09 PM

To fill in the MySQL username and password: 1. Determine the username and password; 2. Connect to the database; 3. Use the username and password to execute queries and commands.

Query optimization in MySQL is essential for improving database performance, especially when dealing with large data sets Query optimization in MySQL is essential for improving database performance, especially when dealing with large data sets Apr 08, 2025 pm 07:12 PM

1. Use the correct index to speed up data retrieval by reducing the amount of data scanned select*frommployeeswherelast_name='smith'; if you look up a column of a table multiple times, create an index for that column. If you or your app needs data from multiple columns according to the criteria, create a composite index 2. Avoid select * only those required columns, if you select all unwanted columns, this will only consume more server memory and cause the server to slow down at high load or frequency times For example, your table contains columns such as created_at and updated_at and timestamps, and then avoid selecting * because they do not require inefficient query se

How to optimize MySQL performance for high-load applications? How to optimize MySQL performance for high-load applications? Apr 08, 2025 pm 06:03 PM

MySQL database performance optimization guide In resource-intensive applications, MySQL database plays a crucial role and is responsible for managing massive transactions. However, as the scale of application expands, database performance bottlenecks often become a constraint. This article will explore a series of effective MySQL performance optimization strategies to ensure that your application remains efficient and responsive under high loads. We will combine actual cases to explain in-depth key technologies such as indexing, query optimization, database design and caching. 1. Database architecture design and optimized database architecture is the cornerstone of MySQL performance optimization. Here are some core principles: Selecting the right data type and selecting the smallest data type that meets the needs can not only save storage space, but also improve data processing speed.

Understand ACID properties: The pillars of a reliable database Understand ACID properties: The pillars of a reliable database Apr 08, 2025 pm 06:33 PM

Detailed explanation of database ACID attributes ACID attributes are a set of rules to ensure the reliability and consistency of database transactions. They define how database systems handle transactions, and ensure data integrity and accuracy even in case of system crashes, power interruptions, or multiple users concurrent access. ACID Attribute Overview Atomicity: A transaction is regarded as an indivisible unit. Any part fails, the entire transaction is rolled back, and the database does not retain any changes. For example, if a bank transfer is deducted from one account but not increased to another, the entire operation is revoked. begintransaction; updateaccountssetbalance=balance-100wh

How to copy and paste mysql How to copy and paste mysql Apr 08, 2025 pm 07:18 PM

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).

See all articles