Ruby - MySQL server has gone away (Mysql2::Error) -


This is a duplicate question: The answer related to this question is not helping me in any way. Please help me get rid of this problem.

MySQL query:

  insert_query =% {my_table INSERT (`my_column`) VALUES (" # {my_value} "}}. Gsub (/ \ s + /, '') Customer = Mysql2 :: Client.new (: host = & gt; 'localhost' ,: username = & gt; "# {ENV ['MYSQLUSERNAME']}",: password = & Gt; "# {ENV ['MYSQLPASSWORD']}") client.query ("USE 'my_database`;") client.query (insert_query)  

inserting values ​​into my_column Meanwhile, I get an error "` query ': MySQL server has gone away "(Mysql2: error) . My_column has MEDIUMTEXT data type and encoded string values ​​will be stored in it if encoded Gaya (Base64.encode64 Ruby ) The string character count is higher (more than 100,000 or 100,000,000) so I am facing an error but if the encoded string length is less then it works well. I wait_timeout and

To resolve it!

, you have more to set up the max_allowed_packet The more packet size limits "max_allowed_packet" should be increased in the /etc/my.cnf file (if the file does not exist, you can create it)

You can set: max_allowed_packet = 128M

and then restart mysql


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -