mySQL Error 1040: Too Many Connection

Posted by

Error:

 production.ERROR: SQLSTATE[08004] [1040] Too many connections (Connection: mysql, SQL: select * from oauth_access_tokens where id = 2377dedb9277d677e7114341b23c3066cc84f4eabaff19cf57ba6713e58d874ac90bb631a1bbc711 limit 1) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 1040): SQLSTATE[08004] [1040] Too many connections (Connection: mysql, SQL: select * from oauth_access_tokens where id = 2377dedb9277d677e7114341b23c3066cc84f4eabaff19cf57ba6713e58d874ac90bb631a1bbc711 limit 1) at /opt/lampp/htdocs/myhospitalnow/mhn-hospital-ms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)

Solution:

Step 1: Increase max_connections in MySQL

dit your MySQL config file (my.cnf or my.ini) depending on your system.

šŸ”§ For Linux (/etc/mysql/my.cnf or /etc/my.cnf)

Find or add this line:

[mysqld]
max_connections = 500

Restart MySQL:

sudo systemctl restart mysql

For XAMPP (/opt/lampp/etc/my.cnf)

  1. Open /opt/lampp/etc/my.cnf
  2. Under [mysqld] section, add:
max_connections=500

Restart XAMPP MySQL:

sudo /opt/lampp/lampp restartmysql
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x