Database connection error

mysql getting error too many connections error #1040

id and password is right when we try to login in it is letting database to connect

website works and then stop

something is not right with mysql

Please help



mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock

symbolic-links=0 innodb_file_per_table = 1 thread_concurrency = 8 query_cache_size = 32M thread_cache_size = 8 myisam_sort_buffer_size = 64M read_rnd_buffer_size = 8M read_buffer_size = 2M sort_buffer_size = 2M table_open_cache = 512 max_allowed_packet = 1M key_buffer_size = 384M

[mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/

!includedir /etc/my.cnf.d

Howdy -- the error you mentioned indicates that MySQL has too many open connections.

That could be due to a web app or plugin not properly closing database connections, or it could be that one website in particular is receiving quite a bit of traffic.

One way to resolve that would be to increase how many connections MySQL will accept.

To do that, open /etc/mysql/my.cnf, look for the "[mysqld]" section, and in there add this line:

max_connections = 500

After adding that, restart MySQL, and then see if your websites are working again.