mysql2
mysql2 copied to clipboard
mysql2 0.4.10 Symbol not found: _mysql_server_init
My current project uses ruby 2.3.1, rails 4.2.7.1 and mysql2 0.4.10, I'm running all that on MacOS Catalina 10.15.3
Installed mysql2 with no errors:
$ gem install mysql2 -v '0.4.10' -- --with-mysql-dir=/usr/local/opt/[email protected]
Fetching mysql2-0.4.10.gem
Building native extensions with: '--with-mysql-dir=/usr/local/opt/[email protected]'
This could take a while...
Successfully installed mysql2-0.4.10
Parsing documentation for mysql2-0.4.10
Installing ri documentation for mysql2-0.4.10
Done installing documentation for mysql2 after 0 seconds
1 gem installed
got an error after trying to create db:
$ bundle exec rake db:create
dyld: lazy symbol binding failed: Symbol not found: _mysql_server_init
Referenced from: /Users/mike/.rvm/gems/ruby-2.3.1@projectname/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_server_init
Referenced from: /Users/mike/.rvm/gems/ruby-2.3.1@projectname/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
Expected in: flat namespace
[1] 58001 abort bundle exec rake db:create
The solution described at issue #1001 didn't help.
Please advice how to resolve it.
This error indicates that the mysql libraries can not be found during runtime. This is most probably because the directory containing the mysql libraries is not in one of the “standard” paths. (Note that specifying --with-mysql-dir at compile time does not impact the runtime search paths.)
One way to solve this problem is with brew link --force [email protected] (because this will make the runtime library available in a standard path).
if you face the issue on mac big sur with mysql 8.0.26. You need to provide mysql dir as explained in docs
$ gem install mysql2 -v '0.5.3' -- --with-mysql-dir=/opt/homebrew/Cellar/mysql-client/8.0.26
Having the same issue as above except I am running Monterrey on an M1 mac and none of those potential solutions seem to work.
Any one have solution for this issue of 'mysql2', '~> 0.3.0'? I am using Monterrey on an M1 mac.