search
Homephp教程php手册MySQL 的 Daemon 启动参数

mysql

假设你的启动脚本是/etc/init.d/mysql

那么找到$bindir/safe_mysqld这行,加上如下参数

-O max_connections=1000 -O wait_timeout=500 -O interactive_timeout=500

当然,得根据你的实际情况加以修改,不过默认值对于我们公司这样负载的服务器是不可想象的……

现在,你的MySQL启动文件有可能看起来像这样:

............

$bindir/safe_mysqld --user=mysql --datadir=$datadir --pid-file=$pid_file -O max_connections=1000 -O wait_timeout=500 -O interactive_timeout=500&

............

修改完成之后,重启MySQL即可,注意一定要先使用mysqladmin shutdown 服务器。

推荐在my.cnf中配置这些参数。

如果你有MySQL的源代码版本,你可以在support-files目录下找到my-huge.cnf, my-large.cnf

分别打开看看,选择适合你的那个文件

抄一段话:

# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is @localstatedir@) 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.

建议加入精华:)



Statement
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

Video Face Swap

Video Face Swap

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

Hot Tools

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

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function