Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-27, 21:35:23

Author Topic: How to limit connection MySQL  (Read 3619 times)

0 Members and 1 Guest are viewing this topic.

Offline hoangsang

  • Valuable Member
  • *
  • Posts: 97
  • Karma: +0/-0
    • View Profile
How to limit connection MySQL
« on: 2015-06-05, 17:56:28 »
How to limit about 200 connection MySQL?
Thanks!
Code: [Select]
A. Kloxo-MR: 7.0.0.b-2015053102
   - Web: hiawatha-9.13.0-f.6.mr.el6.x86_64
   - PHP: php54s-5.4.41-1.ius.el6 (fpm mode)
B. Plateform:
   - OS: CentOS release 6.6 (Final) x86_64
   - Hostname: bns.bachngocsach.net
C. Services:
   1. MySQL: MariaDB-server-10.0.19-1.el6.x86_64
   2. PHP:
      - Branch: php53u-5.3.29-1.ius.el6.x86_64
   3. Httpd: httpd-2.2.29-2.mr.el6.x86_64
      - PHP Type: php-fpm_event
   4. Lighttpd: --uninstalled--
   5. Hiawatha: --unused--
   6. Nginx: --uninstalled--
   7. Cache: varnish-3.0.7-1.el6.x86_64
   8. Dns: bind-9.9.5-1.el6.x86_64
   9. Qmail: qmail-toaster-1.03-1.3.55.mr.el6.x86_64
      - with: courier-imap-toaster-4.1.2-1.3.18.mr.el6.x86_64

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: How to limit connection MySQL
« Reply #1 on: 2015-06-05, 18:29:39 »
Add 'max-connections=100' under '[mysqld]' in /etc/my.cnf.d/server.cnf
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline hoangsang

  • Valuable Member
  • *
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: How to limit connection MySQL
« Reply #2 on: 2015-06-05, 18:41:24 »
Add 'max-connections=100' under '[mysqld]' in /etc/my.cnf.d/server.cnf
I'm edited:
Code: [Select]
[mysqld]
max_connections = 400
max_user_connections=200
performance_schema=on
default-storage-engine=myisam
skip-innodb
#OpenVZ AIO bug fix
..................................
OK?

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: How to limit connection MySQL
« Reply #3 on: 2015-06-05, 18:44:59 »
In most situation, 100 is enough.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline hoangsang

  • Valuable Member
  • *
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: How to limit connection MySQL
« Reply #4 on: 2015-06-05, 18:50:32 »
In most situation, 100 is enough.
Thanks!
But i'm restart MySQL show error?????
Code: [Select]
[root@bns ~]# service mysql restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL SUCCESS!


Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: How to limit connection MySQL
« Reply #5 on: 2015-06-05, 18:54:01 »
Don't panic. Try 'pkill -9 mysql; sh /script/restart-mysql -y'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline hoangsang

  • Valuable Member
  • *
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: How to limit connection MySQL
« Reply #6 on: 2015-06-05, 19:12:46 »
Don't panic. Try 'pkill -9 mysql; sh /script/restart-mysql -y'.
Show mess:
Code: [Select]
[root@bns ~]# pkill -9 mysql; sh /script/restart-mysql -y

 ERROR! MySQL server PID file could not be found!
Starting MySQL. SUCCESS!
-------------------------------------------------------------------

- For help, type '/script/restart-mysql [--help|-h]'


Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: How to limit connection MySQL
« Reply #7 on: 2015-06-05, 19:20:41 »
Check your mysql with 'service mysql status'. In most situation, avoid above message.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

 


MRatWork Affiliates:    BIGRAF(R) Inc.    House of LMAR    EFARgrafix
Click Here

Page created in 0.041 seconds with 18 queries.

web stats analysis