Linux下修改Mysql最大並發串連數

來源:互聯網
上載者:User

標籤:

輸入的命令如下:

/usr/local/mysql/bin/mysqladmin -uroot -pyyyyyy variables |grep max_connections

nano /etc/my.cnf

max_connections=200

service mysql restart

 

在mysql中最大並發串連數修改方法只要在my.cnf檔案加找到max_connections 或修改max_connections 的參考即可了,後面的參數越大就是並發越大了

1.先查看下當前MYSQL的最大串連數 注意,root替換成你的資料庫,不過一般預設就是root,password是資料庫密碼,) 入以上命令後會顯示下面的資訊,這個是最大串連數是100

[[email protected] ~]# /usr/local/mysql/bin/mysqladmin -uroot -pyyyyyyyy variables |grep max_connections

2.修改最大串連數為200

[[email protected] ~]# nano /etc/my.cnf

輸入以上命令後會進入my.cnf檔案內容,在其中加入下面這行代碼

max_connections=200

使用上下箭頭移動游標,輸入後按ctrl+o按鍵組合後儲存,儲存的時候要再按斷行符號鍵確定的,確定後按ctrl+x按鍵組合退出回到命令列

3.最後一步就是重啟mysql [[email protected] ~]#  service mysql restart //重啟mysql的命令

 

 

LINUX命令介面如下:

Xshell for Xmanager Enterprise 5 (Build 0488) Copyright (c) 2002-2014 NetSarang Computer, Inc. All rights reserved.

Type `help‘ to learn how to use Xshell prompt. [c:\~]$

Connecting to 203.86.8.114:22... Connection established. To escape to local shell, press ‘Ctrl+Alt+]‘.

WARNING! The remote SSH server rejected X11 forwarding request. Last login: Wed Aug 19 17:25:35 2015 from 61.143.61.19 [[email protected] ~]# /usr/local/mysql/bin/mysqladmin -uroot -pyyyyyy variables |grep max_connections | max_connections                         | 10                                                                                       

| [[email protected] ~]# nano /etc/my.cnf

[[email protected] ~]# /usr/local/mysql/bin/mysqladmin -uroot -pzhengou$%#1980 variables |grep max_connections error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted /usr/local/mysql/bin/mysqladmin: connect to server at ‘localhost‘ failed error: ‘Too many connections‘

[[email protected] ~]# service mysql restart error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted Shutting down MySQL..                                      [確定] error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted Starting MySQL.                                            [確定]

[[email protected] ~]# /usr/local/mysql/bin/mysqladmin -uroot -pyyyyyyy variables |grep max_connections error: Found option without preceding group in config file: /etc/my.cnf at line: 3 Fatal error in defaults handling. Program aborted | max_connections                         | 151                                                                                       |

[[email protected] ~]# nano /etc/my.cnf

  GNU nano 1.3.12                File: /etc/my.cnf                                       

 

max_connections=200

# Example MySQL config file for medium systems. # # This is for a system with little memory (32M - 64M) where MySQL plays # an important part, or systems up to 128M where MySQL is used together with # other programs (such as a web server) # # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. For information about these locations, see: # http://dev.mysql.com/doc/mysql/en/option-files.html # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "--help" option.

# The following options will be passed to all MySQL clients [client]                                     [ Read 146 lines ] ^G Get Help    ^O WriteOut    ^R Read File   ^Y Prev Page   ^K Cut Text    ^C Cur Pos ^X Exit        ^J Justify     ^W Where Is    ^V Next Page   ^U UnCut Text  ^T To Spell

Linux下修改Mysql最大並發串連數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.