mysql的一些运行效率等优化设置,建议拥有服务器的朋友,可以测试。
如果使用的是MySQL 5.0.x
可以直接将以下内容保存替换MySQL中的my.ini,记得要修改basedir和datadir两个栏目的路径。
代码如下:
[client]
port=3306
[mysql]
default-character-set=gbk
[mysqld]
port=3306
basedir="D:/web/mysql/"
datadir="D:/web/mysql/Data/"
default-character-set=gbk
default-storage-engine=MYISAM
max_connections=1910
query_cache_limit=2M
query_cache_size=64M
query_cache_type=1
table_cache=64
tmp_table_size=32M
thread_cache_size=64
myisam_sort_buffer_size=8M
key_buffer_size=256M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=208K
skip-bdb
back_log=500
skip-locking
skip-innodb
thread_concurrency=16
max_connect_errors=30000
wait_timeout=120
max_allowed_packet=2M
interactive_timeout=120
local-infile = 0
增加数据库日志记录
在MySQL的配置文件my.ini最下面加入以下内容,将你需要记录的日志类型栏目前面的#注释符去掉,然后=后面填写日志文件名称(该文件需手动建立,程序方可在其写入日志)使其生效。
代码如下:
#Enter a name for the error log file. Otherwise a default name will be used.
#log-error=
#Enter a name for the query log file. Otherwise a default name will be used.
#log=
#Enter a name for the slow query log file. Otherwise a default name will be used.
#log-slow-queries= log-slow-queries.txt
#Enter a name for the update log file. Otherwise a default name will be used.
#log-update=
#Enter a name for the binary log. Otherwise a default name will be used.
#log-bin=
增加中文全文索引
在MySQL的配置文件my.ini最下面加入以下内容。
代码如下:
# Minimum word length to be indexed by the full text search index.
# You might wish to decrease it if you need to search for shorter words.
# Note that you need to rebuild your FULLTEXT index, after you have
# modified this value.
ft_min_word_len = 1
从MySQL4.0开始就支持全文索引功能,但是MySQL默认的最小索引长度是4。如果是英文默认值是比较合理的,但是中文绝大部分词都是2个字符,这就导致小于4个字的词都不能被索引,全文索引功能就形同虚设了。国内的空间商大部分可能并没有注意到这个问题,没有修改MySQL的默认设置。
为什么要用全文索引呢?
一般的数据库搜索都是用的SQL的like语句,like语句是不能利用索引的,每次查询都是从第一条遍历至最后一条,查询效率极其低下。一般数据超过10万或者在线人数过多,like查询都会导致数据库崩溃。这也就是为什么很多程序都只提供标题搜索的原因了,因为如果搜索内容,那就更慢了,几万数据就跑不动了。
MySQL全文索引是专门为了解决模糊查询提供的,可以对整篇文章预先按照词进行索引,搜索效率高,能够支持百万级的数据检索。
如果您使用的是自己的服务器,请马上进行设置,不要浪费了这个功能。
如果您使用的是虚拟主机,请马上联系空间商修改配置。首先,MySQL的这个默认值对于中文来说就是一个错误的设置,修改设置等于纠正了错误。其次,这个配置修改很简单,也就是几分钟的事情,而且搜索效率提高也降低了空间商数据库宕掉的几率。如果你把本篇文章发给空间商,我相信绝大部分都会愿意改的。
重启方法
方法一:在开始-运行输入: 回车,再在运行输入: 回车。
方法二:或者开始-控制面板-管理工具-服务,然后找到 MySQL这一项点击右键,选择重启服务。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software