首页 > 技术文章 > MySQL my.cnf配置文件及配置systemctl命令

ruhuanxingyun 2021-03-03 15:31 原文

一、my.cnf文件

  1. 最大连接数:max_connections=2000,查询语句为:show variables like 'max_connections';

  2. 是否开启缓存:query_cache_type=ON,查询语句为:show variables like '%query_cache%';

 

二、systemctl命令

[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

Type=forking

PIDFile=/var/run/mysqld/mysqld.pid

# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0

# Execute pre and post scripts as root
PermissionsStartOnly=true

# Needed to create system tables
#ExecStartPre=/usr/bin/mysqld_pre_systemd

# Start main service
ExecStart=/usr/local/mysql/support-files/mysql.server start

# Use this to switch malloc implementation
#EnvironmentFile=-/etc/sysconfig/mysql

# Sets open_files_limit
LimitNOFILE = 5000

Restart=on-failure

RestartPreventExitStatus=1

PrivateTmp=false

 

三、其他

  1. mysql两种连接方式

    A. TCP/IP:采用mysql命令登录,指定参数-h时,会使用TCP/IP方式连接,这是一种常用方式;

    B. socket:当server和client在同一台服务器上时,可以采用mysql命令登录,不指定参数时,默认是使用socket方式,此方式连接快。

  2. 进程间通讯方式:管道、命名管道、命名字、TCP/IP套接字、Unix域名套接字。

 

可参考:http://www.linuxe.cn/post-631.html

    进程间通讯的7种方式

推荐阅读