libmysqlclient load error when deploying with Capistrano

Asked 2 years ago, Updated 2 years ago, 119 views

When I was deploying Rails in AWS, there was a heading error, so I looked at articles online, but I couldn't solve it.

Also, I am planning to deploy Capistrano 3.

ruby-v
ruby 2.2.3p173

LoadError: /usr/lib64/mysql/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by/var/project_name/shared/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.2.0-static/mysql2-0.3.20/myarname/varname)

http://qiita.com/pollseed/items/b7d187dbbd64b29820d4#%E5%AF%BE%E5%BF%9C3-1libmysqlclient%E5%91%A8%E3%82%8A

in this article
$ldd/usr/lib64/mysql/libmysqlclient.so.18

I have set it the same way up to , and the result is the same.

*Mysql matches the same version as the article.

However,

in the article.
ldd.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.2.0-static/mysql2-0.3.18/mysql2/mysql2.so
ldd.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18/ext/mysql2/mysql2.so
ldd.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18/lib/mysql2/mysql2.so

There was no .rbenv in the first place, so

$pwd
/var/project_name/releases/201606050652

This part has not been completed due to an error when running under .
(No such file or directory)

By the way, rbenv itself should have been installed.

$whichrbenv
/usr/local/rbenv/bin/rbenv

Is it a problem with rbenv, mysql, or something else?
I don't know the cause.

When I looked into it, I was confused because there were many articles that said socket was the cause and my.cnf misconfiguration.

I have repeatedly checked socket and my.cnf.

Socket is unified to /tmp/mysql.sock along with rails database.yml.sock

.
 [mysqld]
#
# Remove leading# and set to the amount of RAM for the most important data
# cache in MySQL.Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size=128M
#
# Remove leading# to turn on a very important data integrity option:logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading# to set options mainly useful for reporting servers.
# The server defaults are fast for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size=128M
# sort_buffer_size=2M
# read_rnd_buffer_size=2M
datadir=/var/lib/mysql
socket=/tmp/mysql.sock

# Disabling symbolic-links is recommended to preempt assigned security risks
symbolic-links = 0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

explicit_defaults_for_timestamp=1
skip-grant-tables


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
socket=/tmp/mysql.sock

Also, if you hit the mysql command on the server, mysql will start properly.

I would appreciate it if someone could give me some advice.

Thank you for your cooperation.

ruby-on-rails mysql deployment capistrano

2022-09-29 21:20

1 Answers

I think it's because the libmysqlclient in the environment where mysql2.so was compiled is different from the libmysqlclient in the running environment.

You may want to recompile mysql2.so in the running environment.


2022-09-29 21:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.