0

We're working in a same project from three computers connected to same LAN. We want to maintain one common database for three same projects running in different computers.

We've created a database in a 4th pc and changed the httpd-xampp.conf file. We've added the "Require all granted" in phpmyadmin alias so that we can access the database from another pc in same LAN. We can access the phpmyadmin page through browser and also can create db manually in the web page. But the problem is we can't connect to the database from laravel project.

We've changed the following lines in .env

DB_HOST=192.168.0.155
DB_PORT=3306

But we're facing the following error.

SQLSTATE[HY000] [2006] MySQL server has gone away
Sudipto Roy
  • 51
  • 1
  • 5

1 Answers1

1

It's not exactly LAN problem. The most common cause for this is that server timed out and closed the connection. Please check wait_timeout parameter in your my.ini file, usually found from X:\xampp\mysql\bin\ folder. Another reason for this would be max_allowed_packet parameter. Try increasing that too. Once done, please restart your XAMPP and try again.

yivi
  • 42,438
  • 18
  • 116
  • 138
  • In my xampp my.ini file I've found the following line. innodb_lock_wait_timeout=28800 But I couldn't find the wait_timeout. Are they both same? I've increased the max_allowed_packet to 256 by the way. – Sudipto Roy Mar 04 '20 at 09:45
  • @SudiptoRoy They are not the same. In the [mysqld] section of my.ini you may add a new line for wait_timeout=28800 to have the same 8 hour window before a connection will be terminated. If two hours is reasonable, wait_timeout=7200 for your limit. – Wilson Hauck Mar 05 '20 at 13:44
  • @SudiptoRoy Could you post TEXT results of A) SHOW GLOBAL VARIABLES LIKE '%timeout%'; so we have some idea what you are running with? – Wilson Hauck Mar 05 '20 at 13:49
  • @SudiptoRoy Please tell us your result from SELECT @@max_allowed_packet; This will be the maximum bytes allowed in a single packet to be managed. We are also waiting on posting TEXT results of SHOW GLOBAL VARIABLES LIKE '%timeout%'; . – Wilson Hauck Mar 21 '20 at 16:29