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
)
- Open
/opt/lampp/etc/my.cnf
- Under
[mysqld]
section, add:
max_connections=500
Restart XAMPP MySQL:
sudo /opt/lampp/lampp restartmysql