Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 700 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error installing mysql2: Failed to build gem native extension

#21
On Debian Stretch the package that worked for me was **default-libmysqlclient-dev**

```sudo apt-get update && apt-get install -y default-libmysqlclient-dev
```
Reply

#22
I'm on a mac and use [homebrew][1] to install open source programs. I did have to install mac Dev tools in order to install homebrew, but after that it was a simple:

brew install mysql

to install mysql. I haven't had a mysql gem problem since.


[1]:

[To see links please register here]

Reply

#23
On Ubuntu/Debian and other distributions using aptitude:

sudo apt-get install libmysql-ruby libmysqlclient-dev

Package `libmysql-ruby` has been phased out and replaced by `ruby-mysql`. [This][1] is where I found the solution.

If the above command doesn't work because `libmysql-ruby` cannot be found, the following should be sufficient:

sudo apt-get install libmysqlclient-dev

On Red Hat/CentOS and other distributions using yum:

sudo yum install mysql-devel

On Mac OS X with [Homebrew][2]:

brew install mysql


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#24
I had this issue on Windows 7. This is apparently an incompatibility issue and the solution is as follows:

Download the `libmySQL.dll` file from an older InstantRails installer. It is available from the [InstantRails GitHub repo][1].

Next, copy that file into your Ruby/bin folder.

Now, you are good to go ;)


[1]:

[To see links please register here]

Reply

#25
In my case this helped:

```sh
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
```

Then:

```sh
gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/' -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
```

Result:

```
Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Installing ri documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed
```

[See this post](

[To see links please register here]

) (WARNING: Japanese language inside).
Reply

#26
For __MacOS Mojave__:

`gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include`
Reply

#27
**On Ubuntu(18.04)**

i was able to solve this issue by running the following:

sudo apt-get install build-essential libmysqlclient-dev
gem install mysql2

[reference][1]


[1]:

[To see links please register here]

Reply

#28
I can see most of the people have found the solution to this problem, this is mostly coused but not limited to missing packages, this happened to me after I have purged mysql and reinstalled it. I had to run this command in order to fix my problem:

`sudo apt-get install libmysqlclient-dev`

This command helped me fix my problem
Reply

#29
Under ubuntu 20.04 LTS it's the only solution that have been working for me:

sudo apt-get install ruby-mysql2
Reply

#30
According to

[To see links please register here]

, I fixed it by
```bash
gem install mysql2 -- \
--with-mysql-lib=/usr/local/Cellar/mysql/8.0.26/lib \
--with-mysql-dir=/usr/local/Cellar/mysql/8.0.26 \
--with-mysql-config=/usr/local/Cellar/mysql/8.0.26/bin/mysql_config \
--with-mysql-include=/usr/local/Cellar/mysql/8.0.26/include
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through