8

When I log into my command line mysql I can no longer access any PHP application that requires a database connection. This happens every time. The steps to cause the issue on my localhost:

Command line:
mysql -u root (no password for localhost)
mysql> 

I do not execute or do anything at this point. I load up any page that requires a database connection using root:

PDO::__construct(): send of 108 bytes failed with errno=32 Broken pipe

If I exit mysql the pages come back but another issue comes up when attempting to load two pages at the same time (in browser tabs) it will cause one of them to break until the page loads, then I can refresh

My.cnf:

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

wait_timeout=5000
max_allowed_packet=100m
max_user_connections=1000
chadpeppers
  • 2,057
  • 1
  • 20
  • 27
  • have you restarted mysql since you have updated your settings? – cmorrissey Mar 20 '15 at 14:59
  • Do you have any special encodings for your connection string? What is your default character set for mysql? – Spechal Mar 20 '15 at 14:59
  • also I don't know if this makes a difference but you may want a capital `M` on the `max_allowed_packet` – cmorrissey Mar 20 '15 at 15:04
  • I have restarted it. It seems to have always happen since i installed mysql on OSX. I checked my character set and it says latin1. not sure if that is what its suppose to be? – chadpeppers Mar 20 '15 at 15:06
  • 1
    I am facing the same error on mac. any solution for this? – MagePsycho Nov 30 '16 at 21:57
  • try raising the max allowed packet via the command line. Look here at second answer. http://stackoverflow.com/questions/8062496/how-to-change-max-allowed-packet-size – chadpeppers Dec 01 '16 at 14:47
  • Possible duplicate of [mysql\_pconnect(): send of 5 bytes failed with errno=32 Broken pipe](http://stackoverflow.com/questions/1894317/mysql-pconnect-send-of-5-bytes-failed-with-errno-32-broken-pipe) – Matt S Apr 25 '17 at 21:28

2 Answers2

3

Set up wait_timeout in your MySQL my.cnf config file:

wait_timeout=3600

This config file is located in the /etc/mysql/my.cnf (Ubuntu/Debian) and /usr/local/mysql/my.cnf (OSX) and /location of server bin folder/mysql/my.cnf for windows.

Restart MySQL server and check this should work.

A.D.
  • 2,352
  • 2
  • 15
  • 25
2

For "Send of X bytes failed with errno=32 Broken pipe", most responses around the internet would advise you to increase wait_timeout for your connections. This didn't work for us.

But after struggling for some time, we sort of wildly guessed that it is maybe max_allowed_packet that needs to be increased. And indeed, lifting it up to 500M did a good job.

Only after it already worked, we found that other people have similar experience (e.g. https://www.somacon.com/p574.php )

Miro
  • 81
  • 4