`
willvvv
  • 浏览: 333396 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

python2.6 mysql5.1 MySQL-python1.2.3

阅读更多

使用因为一直找不到mysql_config,就装了一个mysql-server,安装时注意:

 

如果用/usr/local/mysql/scripts/mysql_install_db --user=mysql
有可能会报如下错误:
FATAL ERROR: Could not find ./bin/my_print_defaults
If you are using a binary release, you must run this script from
within the directory the archive extracted into. If you compiled
MySQL yourself you must run 'make install' first.
解决办法:应指定安装路径,数据存放路径
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/

 

 

MySql加入到系统服务里面:

cp support-files/mysql.server /etc/rc.d/mysql    

#把msql的脚本文件拷到系统的启动目录下

cd /etc/init.d/

chkconfig --add mysql                                 # mysql 加到启动服务列表里

chkconfig mysql on                                     # 让系统启动时自动打开 mysql 服务

 

后来又报错cannot find -lmysqlclient_r,找了一下没有办法,只好从头来。


正确的步骤是:

  1. 下载对应操作系统的mysql-dev包,如我的操作系统是SUSE Linux Enterprise Server 11 (x86_64),到mysql官网http://dev.mysql.com/downloads/mysql/#downloads 下载对应版本MySQL-devel-community-5.1.51-1.sles11.x86_64.rpm,然后rpm -ivh MySQL-devel-community-5.1.51-1.sles11.x86_64.rpm
  2. 下载MySQL-python-1.2.3.tar.gz 从http://sourceforge.net/projects/mysql-python/,解压后修改site.cfg,指定mysql_config = /usr/bin/mysql_config,然后python setup.py install,终于安装上去了。

 

使用的时候又出问题了,提示Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock

cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

修改my.cnf的[mysqld]节点下socket        = /var/lib/mysql/mysql.sock

[client]节点下的socket        = /var/lib/mysql/mysql.sock

注意将chown -R mysql /var/lib/mysql/,mysql为启动mysql服务的用户

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics