NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Setting MySQL System Variables on the Fly
Topic: Database   Posted:2007-01-23
Printer Friendly: Print

spacerspacer
Many MySQL system variables can be set on the fly at the command line, without restarting the server. This is a great thing at times, like when that new code which was so thoroughly "tested" winds up consuming five times the database connections as the old version. Oops! Well, within the limits of the resources available on the database server, we can make more connections available without bouncing.

mysql> select @@global.max_connections;
+--------------------------+
|      @@global.max_connections |
+--------------------------+
|                                           100 |
+--------------------------+
1 row in set (0.00 sec)

mysql> set @@global.max_connections = 1250;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.max_connections;
+--------------------------+
|      @@global.max_connections |
+--------------------------+
|                                         1250 |
+--------------------------+
1 row in set (0.00 sec)

We'd better make this change in my.cnf so it will persist if the server restarts. That file will be found in /etc or /usr/local/mysql -- or possibly /usr/local/mysql/data for older versions. Just find the max_connections entry in the mysqld section of the file, or add your own if it doesn't exist.

max_connections = 1250

You can also use the "default" keyword to reset many variables back to their default value. In our case, this would set the max_connections back to 100, the MySQL default.

mysql> set @@global.max_connections=default;
Query OK, 0 rows affected (0.00 sec)
mysql> select @@global.max_connections;
+--------------------------+
|      @@global.max_connections |
+--------------------------+
|                                           100 |
+--------------------------+
1 row in set (0.00 sec)

Super privileges are required for setting global system variables. Many system variables have session values, as well. These may be set without special privileges, but only for the client's own session. For a full list of MySQL dynamic system variables, see http://dev.mysql.com/doc/refman/5.0/en/dynamic-system-variables.html.




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS