mysql-uroot-pgameol32! Or
Mysql-uroot-p Enter the password into the MySQL console again
MySQL Console mode:
Show status; View all MySQL status
Show Processlist; Average user's own current number of connections, root user can view the current number of connections for all users
Show status like '%connections% '; Keyword search
Shell command-line mode:
Mysqladmin-uroot-p variables view MySQL current running status
To modify the maximum number of MySQL connections:
First, immediate changes, immediate effect
Mysql-uroot-p
Mysql> set GLOBAL max_connections=1000; Default maximum number of connections 100
Mysql> show Processlist; Displays the currently running query request
Mysql> Show status; Displays the current status
Mysql> exit; Exit MySQL Console
Mysqladmin-uroot-p variables
System restart failure
Scripts can be written to execute scripts when the system initiates initialization, modifying the maximum number of connections
Second, modify the configuration file, restart the effective
For example, the MySQL 5.0.83 rpm version below CentOS 5.4 illustrates:
Find/usr/bin/mysqld_safe edit it, find the two lines that mysqld started, and add the following parameters:
-O max_connections=1000
Special description in Scarlet Letter:
If Test-z "$args"
Then
$NOHUP _niceness $ledir/$MYSQLD $defaults--basedir= $MY _basedir_version--datadir= $DATADIR $USER _option--pid-file=$ Pid_file--skip-external-locking- o max_connections=1000>> $err _log 2>&1
Else
EVAl "$NOHUP _niceness $ledir/$MYSQLD $defaults--basedir= $MY _basedir_version--datadir= $DATADIR $USER _option-- pid-file= $pid _file--skip-external-locking $args- o max_connections=1000>> $err _log 2>&1 "
Fi
This code is not easy to find, and can not say clearly in which location. However, it is advisable to look forward from the very end.
Restart MySQL service: # service MySQL Restart
View current maximum number of connections: #/USR/LOCAL/MYSQL/BIN/MYSQLADMIN-UROOT-P variables
Enter the password of the root database account to see
Max_connections 1000 that the new changes are in effect.
Three
Modify Mysqld Startup file/etc/init.d/mysqld Add code at the end of the start () function
Mysql-e ' Set GLOBAL max_connections=1000; ' Such as
Start () {
[-X $exec] | | Exit 5
# Check to see if it ' s already running
Response= '/usr/bin/mysqladmin--socket= "$socketfile"--user=unknown_mysql_user ping 2>&1 '
If [$ = 0]; Then
# already running, do nothing
Action $ "Starting $prog:"/bin/true
Ret=0
elif echo "$RESPONSE" | Grep-q "Access denied for user"
Then
# already running, do nothing
Action $ "Starting $prog:"/bin/true
Ret=0
Else
# Prepare for Start
Touch "$errlogfile"
Chown mysql:mysql "$errlogfile"
chmod 0640 "$errlogfile"
[-x/sbin/restorecon] &&/sbin/restorecon "$errlogfile"
if [!-d "$datadir/mysql"]; Then
# First, make sure $datadir are there with correct permissions
if [!-e "$datadir"-A!-h "$datadir"]
Then
Mkdir-p "$datadir" | | Exit 1
Fi
Chown mysql:mysql "$datadir"
chmod 0755 "$datadir"
[-x/sbin/restorecon] &&/sbin/restorecon "$datadir"
# now create the database
Action $ "Initializing MySQL database:"/usr/bin/mysql_install_db--datadir= "$datadir"--user=mysql
Ret=$?
Chown-r mysql:mysql "$datadir"
If [$ret-ne 0]; Then
Return $ret
Fi
Fi
Chown mysql:mysql "$datadir"
chmod 0755 "$datadir"
# Pass All the options determined above, to ensure consistent behavior.
# In many cases Mysqld_safe would arrive at the same conclusions anyway
# but we need to be sure. (An exception are that we don ' t force the
# Log-error setting, since this script doesn ' t really depend on that,
# and some users might prefer to configure logging to syslog.)
# Note:set--basedir To prevent probes that might trigger SELinux
# alarms, per bug #547485
$exec--datadir= "$datadir"--socket= "$socketfile" \
--pid-file= "$mypidfile" \
--BASEDIR=/USR--user=mysql >/dev/null 2>&1 &
safe_pid=$!
# Spin for a maximum of N seconds waiting for the server to come up;
# exit the loop immediately if Mysqld_safe process disappears.
# rather than assuming we know a valid username, accept an "access
# denied "response as meaning the server is functioning.
Ret=0
starttimeout=120
While [$STARTTIMEOUT-GT 0]; Do
Response= '/usr/bin/mysqladmin--socket= ' $socketfile '--user=unknown_mysql_user ping 2>&1 ' && break
echo "$RESPONSE" | Grep-q "Access denied for user" && break
if! /bin/kill-0 $safe _pid 2>/dev/null; Then
echo "MySQL Daemon failed to start."
Ret=1
Break
Fi
Sleep 1
Let Starttimeout=${starttimeout}-1
Done
If [$STARTTIMEOUT-eq 0]; Then
echo "Timeout error occurred trying to start MySQL Daemon."
Ret=1
Fi
If [$ret-eq 0]; Then
Action $ "Starting $prog:"/bin/true
Touch $lockfile
Else
Action $ "Starting $prog:"/bin/false
Fi
Fi
mysql-e ' Set GLOBAL max_connections=1000; '
Return $ret
}
Iv. Modification of Windows system
Go to the MySQL installation directory to open the MySQL profile My.ini or my.cnf find max_connections=100 modify it for the max_connections=1000 service to restart MySQL. This method is simple and convenient for MySQL settings under Windows. If it's Linux, see below.
To modify the maximum number of MySQL connections