How to fix this mysql error

mysqli_real_connect(): (HY000/1203): User … already has more than ‘max_user_connections’ active connections

how to fix this

Please check your mysql config, the user reach the maximal connection limit: https://github.com/hestiacp/hestiacp/blob/f4d2845bf507f9a69127c9e920ea21261e29fecb/install/deb/mysql/my-medium.cnf#L35

how to check how many max user connection can server handle?

Login to your server using ssh or console and check configuration under /etc/mysql/my.cnf.

no i’m not mean that. i want to know how many max user connections can handle on my server. how can i figure out that.i just increase the max_connections=200 to 400
max_user_connections=50 to 100.
is this bad?
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock

[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log

symbolic-links=0

skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 32M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M

#innodb_use_native_aio = 0
innodb_file_per_table

max_connections=400
max_user_connections=100
wait_timeout=10
interactive_timeout=50
long_query_time=5

!includedir /etc/mysql/conf.d/

Your max_user_connections is set to 100, so for your question: 100.
max_connections needs also to be extended, otherwise mysql would hit there a limit if multiple user reaches their max_user_connections.

You can increase this basicly to whatever you want, but 100 connections are already alot - this sounds more like a problem within the website/db connection.

yeah i increate that max user connections to 100. default was 50.

my website is a url shortening site. i used this script and host on ovh vps. 4gb ram/1 core cpu/40gb ssd. daily i received around 200000 traffic. today i faces this error when trying to log to phpmyadmin.

So it sounds about planed traffic, so you can expand it for sure.

Warning in ./libraries/classes/Dbi/DbiMysqli.php#213
Error while sending QUERY packet. PID=5430

how to fix this error?

Usualy, the best way is to ask google first, based on a copy paste of your error message: https://stackoverflow.com/questions/30753674/error-while-sending-query-packet

1 Like

i increased everything. but still site loads slowly. load average around 140+.

limits are there to prevent your server from getting overloaded. obviously the server you chose can’t handle the load properly.
I am not familiar with that url shortener script, but your server is probably too small for your amount of traffic. could be a lot of things like load-times of ads/images or whatever you show on that redirects etc.

if your script then waits for the client to load all stuff properly it might block the connection for quite some time. simply increasing the connection limit most likely will make things worse.

I’d start with checking if things like persistent connections or keep-alive can be disabled as they might add to the blocking. also a single core only might not be a good choice to handle concurrent stuff.

last but not least check if your redirect script loads too much unneeded stuff that needs to be optimized.

2 Likes

i upgraded to 8gb ram,2 core vps. but still have the problem. there isn’t any ads or images shown when redirects.

It sounds more like a problem with the script as a hestia one. I would suggest to let a seasoned syadmin check your system or switch to a (managed) webhosting. I don’t think we have much possibilities to help here.

2 Likes