手机版
你好,游客 登录 注册
背景:
阅读新闻

Ubuntu 升级到12.04引起的MySQL错误

[日期:2012-06-09] 来源:Linux社区  作者:Linux [字体:大 中 小]

Ubuntu 12.04中将MySQL升级到5.5.22导致原先的MySQL加载失败

解决方法:

1.完全卸载原先的MySQL

  1. sudo apt-get remove mysql-server   
  2. sudo apt-get autoremove --purge mysql-server   
  3. sudo apt-get remove mysql-common(这步比较重要)   
  4. dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P  

2.重新安装mysql(安装前最好重启)

sudo apt-get install mysql-server  
sudo apt-get install mysql-workbench(原先的client无法使用) 

可使用以下命令检查是否安装成功

sudo netstat -tap | grep mysql 

3.原先gem中的mysql2需要重新编译安装

  1. gem uninstall mysql2   
  2. gem install mysql2  

4.安装mysql2时可能出现以下错误

  1. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.   
  2.   
  3. /homexxx/.rbenv/versions/1.9.3-p125/bin/ruby extconf.rb    
  4. checking for rb_thread_blocking_region()... yes   
  5. checking for rb_wait_for_single_fd()... yes   
  6. checking for mysql_query() in -lmysqlclient... no   
  7. checking for main() in -lm... yes   
  8. checking for mysql_query() in -lmysqlclient... no   
  9. checking for main() in -lz... yes   
  10. checking for mysql_query() in -lmysqlclient... no   
  11. checking for main() in -lsocket... no   
  12. checking for mysql_query() in -lmysqlclient... no   
  13. checking for main() in -lnsl... yes   
  14. checking for mysql_query() in -lmysqlclient... no   
  15. checking for main() in -lmygcc... no   
  16. checking for mysql_query() in -lmysqlclient... no   
  17. *** extconf.rb failed ***   
  18. Could not create Makefile due to some reason, probably lack of   
  19. necessary libraries and/or headers.  Check the mkmf.log file for more   
  20. details.  You may need configuration options.  

解决方法:

  1. sudo apt-get install libmysql-ruby   
  2. sudo apt-get install libmysqlclient-dev   
  3. gem install mysql  

更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

linux
相关资讯       Ubuntu 12.04 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款