Introduction: mysql databaseIt is a database system with good application. With the development of technology, the workload of mysql database is also very large. At this time, the default number of connections is not enough, this requires increasing the number of connections to the mysql database. There are two ways to change the maximumConnectionsOne is to modify safe_mysqld, and the other is to directly modify the original code and re-compile it. The following two methods are described respectively:
1. Modify safe_mysqld
Find safe_mysqld and edit it. Find the two lines started by mysqld and add the following parameters:
-O max_connections = 1000
For example: (the preceding content is --- the original content, and ++ is modified)
--- Safe_mysqld.orig Mon Sep 25 09:34:01 2000
++ Safe_mysqld Sun Sep 24 16:56:46 2000
@-Random, 10 + random, 10 @@
If test "$ #"-eq 0
Then
Nohup $ ledir/mysqld -- basedir = $ MY_BASEDIR_VERSION -- datadir = $ DATADIR
--- Skip-locking> $ err_log 2> & 1
+ -- Skip-locking-O max_connections = 1000 >>$ err_log 2> & 1
Else
Nohup $ ledir/mysqld -- basedir = $ MY_BASEDIR_VERSION -- datadir = $ DATADIR
--- Skip-locking "$ @" >>$ err_log 2> & 1
+ -- Skip-locking "$ @"-O max_connections = 1000 >>$ err_log 2> & 1
Fi
If test! -F $ pid_file # This is removed if normal shutdown
Then
Disable mysql and restart it.
/Mysqladmin path/mysqladmin-uroot-p variables
Enter the password of the root database account.
| Max_connections | 1000 |
That is, the new change has taken effect.
2. modify the original code
Unlock the original MySQL code and go to the SQL directory to modify mysqld. cc. Find the following line:
{"Max_connections", (long *) & max_connections, 1, 1 },
Change it:
{"Max_connections", (long *) & max_connections, 1, 1 },
Save the disk and exit./configure; make install to achieve the same effect.
The two methods summarized here can make mysql database work well. If you have more and better methods, please share them with us.