ruby-mysql
ruby-mysql copied to clipboard
MySQL server has gone away (Mysql::ClientError::ServerGoneError)
I just upgraded from ruby 2.6 to 3.1.2 and from a mySQL 5 DB to MariaDB 10.6.7
I now get this ServerGoneError when I do a query. I was originally connecting via the loopback interface, but for MariaDB, have switched to using the socket.
As a test, I installed the mysql2 gem, and it works fine with the same code. The only downside is that mysql2 doesn't expose the table names, so if I do switch gems, I will need to rewrite multi-table queries and the code that handles them.
Should have added, this is a brand new server, running Ubuntu 22.04 and ruby-mysql (3.0.0)
I ran into this earlier today when I was trying to query on a connection created with Mysql.new
, rather than Mysql.connect
I ran into this earlier today when I was trying to query on a connection created with
Mysql.new
, rather thanMysql.connect
I received NoMethodError when using connect
. Got Server gone away error when query with connection created with New
method. Any suggestions? Thanks,
My ruby version 2.7.6, mysqld version 8.0.31, ruby-mysql version 3.0.0.