ruby 2.6.3 Ubuntu 16.04 Unable to locate package libmysqlclient-dev
description: Fetching mysql2 0.5.2 Installing mysql2 0.5.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
To solve this I ran following.
gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'
Then got the following error. mysql client is missing. You may need to 'apt-get install libmysqlclient-dev'
now I am stuck and found no solution working. tried google and all other option but no suggestion is working for me. Unable to locate package libmysqlclient-dev
To give you proper answer as I found that all comments are to the point, but I wanted to check if really such issue exists. So I spin up new ubuntu server 16.04 and used following commands to installd mysql gem. I used rvm to install ruby
Now relogin to terminal to rvm command can start with its environment
Now I used
ruby -versionto check I am using same version as you were so got responseruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]Now I used following command to install gem. If it succeed then rails will be also installed.But I am getting same error as yours, now let us solve it as it is saying us how to solve error. This error is already giving me information what should I do. It told me to install following package
And now I tried again and it worked. Hope it will resolve your issue. If you still have issue, than you can try by removing mysql packages you install and reinstall using these commands.