brianmario / mysql2

A modern, simple and very fast Mysql library for Ruby - binding to libmysql
http://github.com/brianmario/mysql2
MIT License
2.25k stars 550 forks source link

Mysql2::Error (Plugin http could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/http.so: cannot open shared object file: No such file or directory): #1169

Open TheMlok opened 3 years ago

TheMlok commented 3 years ago

Hello,

I have RoR app on new Debian 10 server. Version si managed by rbenv and deployed by mina. All bundles are installed into shared/vendor/ app specific environment.

I am not sure where the issue is.

Db server is on different machine, so we are using configuration for connection with host and port.

All database packages instaled on our app system (not database server):

ii  libmariadb-dev                    1:10.3.27-0+deb10u1          amd64        MariaDB database development files
ii  libmariadb-dev-compat:amd64       1:10.3.27-0+deb10u1          amd64        MariaDB Connector/C, compatibility symlinks
ii  libmariadb3:amd64                 1:10.3.27-0+deb10u1          amd64        MariaDB database client library
ii  libmariadbd-dev:amd64             1:10.3.27-0+deb10u1          amd64        MariaDB embedded database, development files
ii  libmariadbd19:amd64               1:10.3.27-0+deb10u1          amd64        MariaDB embedded database, shared library
ii  mariadb-client                    1:10.3.27-0+deb10u1          all          MariaDB database client (metapackage depending on the latest version)
ii  mariadb-client-10.3               1:10.3.27-0+deb10u1          amd64        MariaDB database client binaries
ii  mariadb-client-core-10.3          1:10.3.27-0+deb10u1          amd64        MariaDB database core client binaries
ii  mariadb-common                    1:10.3.27-0+deb10u1          all          MariaDB common metapackage
ii  default-libmysqlclient-dev:amd64  1.0.5                        amd64        MySQL database development files (metapackage)
ii  default-mysql-client              1.0.5                        all          MySQL database client binaries (metapackage)
ii  default-mysql-client-core         1.0.5                        all          MySQL database core client binaries (metapackage)
ii  libdbd-mysql-perl:amd64           4.050-2                      amd64        Perl5 database interface to the MariaDB/MySQL database
ii  mysql-common                      5.8+1.0.5                    all          MySQL database common files, e.g. /etc/mysql/my.cnf

Gemfile.lock has this version of mysql2

    mysql2 (0.5.3)

Connection via mysql client is ok. Also using irb with required mysql2 was successful, but not in rails app.

It ends in this error.

[36a37138-d831-4102-a305-6b7aff93109b] Mysql2::Error (Plugin http could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/http.so: cannot open shared object file: No such file or directory):
[36a37138-d831-4102-a305-6b7aff93109b]
[36a37138-d831-4102-a305-6b7aff93109b] mysql2 (0.5.3) lib/mysql2/client.rb:90:in `connect'
[36a37138-d831-4102-a305-6b7aff93109b] mysql2 (0.5.3) lib/mysql2/client.rb:90:in `initialize'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `new'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `mysql2_connection'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `new_connection'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:923:in `checkout_new_connection'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:902:in `try_to_checkout_new_connection'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:863:in `acquire_connection'
[36a37138-d831-4102-a305-6b7aff93109b] activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:587:in `checkout'

On all our apps. Using ruby versions 2.6.5, 2.7.1, 2.7.2.

What surprised me, that this shared object is not in any deb package and I did not find any record about this lib.

Rails versions are mostly 6.0.

I don't know how it is possible to have such link to that library.

Do you have any idea where this strange bug comes from please?

If you need more info about our environment, please tell me.

Thanks!

grooverdan commented 3 years ago

The user you are connecting to somehow is defined to have a 'http' plugin authentication (I haven't heard of it either) and therefore in the protocol, the server requests that the client gets ready to use this plugin type too. Look at the show create user {username} that you are using to connect to.

asok commented 3 years ago

In our case the issue was the fact that we've put http:// in the host configuration option.