简体   繁体   中英

Connect Ruby on Rails to existing MySQL database (previously installed XAMMP)

I have installed ruby on rails(gitlab exactly) on ubuntu machine with xampp , but I failed to connect existing mysql to ror. I can install the gem mysql2 by running

"gem install mysql2 -- --with-mysql-include=/opt/lampp/include --with-mysql-config=/opt/lampp/bin/mysql_config". 

But when I ran "bundle install", it came out:

 "Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension."

and

"An error occurred while installing mysql2 (0.3.11)" 

and so on. What should I do?

I had the same problem, installing a lib for mysql fixed it for me. Try running:

 sudo apt-get install libmysqlclient-dev

and try to install the gem again.

Hope it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM