pymysql python3 debian squeeze

from : previous post

มันไม่ทำงานครับ… ผมขอโทษ
ต้องทำการ patch ด้วยการ

# git clone https://github.com/petehunt/PyMySQL.git
# cd PyMySQL/
# ./build-py3k.sh 
# cd py3k/
# python3 setup.py install

example.

[email protected]:/usr/src/PyMySQL# ./build-py3k.sh 
Building Python 3.0 version in ./py3k...
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: No changes to ./setup.py
RefactoringTool: Refactored ./pymysql/__init__.py
RefactoringTool: Refactored ./pymysql/charset.py
RefactoringTool: Refactored ./pymysql/connections.py
RefactoringTool: Refactored ./pymysql/converters.py
RefactoringTool: Refactored ./pymysql/cursors.py
RefactoringTool: Refactored ./pymysql/err.py
RefactoringTool: No changes to ./pymysql/util.py
RefactoringTool: No changes to ./pymysql/constants/COMMAND.py
RefactoringTool: No changes to ./pymysql/constants/FIELD_TYPE.py
RefactoringTool: No changes to ./pymysql/tests/__init__.py
RefactoringTool: Refactored ./pymysql/tests/test_DictCursor.py
RefactoringTool: No changes to ./pymysql/tests/test_SSCursor.py
RefactoringTool: Refactored ./pymysql/tests/test_basic.py
RefactoringTool: Refactored ./pymysql/tests/test_issues.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/__init__.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/__init__.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/capabilities.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
RefactoringTool: Refactored ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
RefactoringTool: Files that need to be modified:
RefactoringTool: ./setup.py
RefactoringTool: ./pymysql/__init__.py
RefactoringTool: ./pymysql/charset.py
RefactoringTool: ./pymysql/connections.py
RefactoringTool: ./pymysql/converters.py
RefactoringTool: ./pymysql/cursors.py
RefactoringTool: ./pymysql/err.py
RefactoringTool: ./pymysql/util.py
RefactoringTool: ./pymysql/constants/COMMAND.py
RefactoringTool: ./pymysql/constants/FIELD_TYPE.py
RefactoringTool: ./pymysql/tests/__init__.py
RefactoringTool: ./pymysql/tests/test_DictCursor.py
RefactoringTool: ./pymysql/tests/test_SSCursor.py
RefactoringTool: ./pymysql/tests/test_basic.py
RefactoringTool: ./pymysql/tests/test_issues.py
RefactoringTool: ./pymysql/tests/thirdparty/__init__.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/__init__.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/capabilities.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
RefactoringTool: ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
patching file ./pymysql/__init__.py
patching file ./pymysql/charset.py
patching file ./pymysql/connections.py
patching file ./pymysql/converters.py
patching file ./pymysql/cursors.py
patching file ./pymysql/err.py
patching file ./pymysql/tests/test_DictCursor.py
patching file ./pymysql/tests/test_basic.py
patching file ./pymysql/tests/test_issues.py
patching file ./pymysql/tests/thirdparty/__init__.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/__init__.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/capabilities.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
patching file ./pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
patching file setup.py
Hunk #1 succeeded at 33 (offset 18 lines).



[email protected]:/usr/src/PyMySQL/py3k# python3 setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.1
creating build/lib.linux-x86_64-3.1/pymysql
copying pymysql/__init__.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/connections.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/converters.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/util.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/err.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/charset.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/cursors.py -> build/lib.linux-x86_64-3.1/pymysql
copying pymysql/times.py -> build/lib.linux-x86_64-3.1/pymysql
creating build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/__init__.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/ER.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/FLAG.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/COMMAND.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/CLIENT.py -> build/lib.linux-x86_64-3.1/pymysql/constants
copying pymysql/constants/SERVER_STATUS.py -> build/lib.linux-x86_64-3.1/pymysql/constants
creating build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/test_basic.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/__init__.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/test_issues.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/test_DictCursor.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/test_SSCursor.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/base.py -> build/lib.linux-x86_64-3.1/pymysql/tests
copying pymysql/tests/test_example.py -> build/lib.linux-x86_64-3.1/pymysql/tests
running install_lib
creating /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/__init__.py -> /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/connections.py -> /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/converters.py -> /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/util.py -> /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/err.py -> /usr/local/lib/python3.1/dist-packages/pymysql
copying build/lib.linux-x86_64-3.1/pymysql/charset.py -> /usr/local/lib/python3.1/dist-packages/pymysql
creating /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/__init__.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/ER.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/FLAG.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/COMMAND.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/FIELD_TYPE.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/CLIENT.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/constants/SERVER_STATUS.py -> /usr/local/lib/python3.1/dist-packages/pymysql/constants
copying build/lib.linux-x86_64-3.1/pymysql/cursors.py -> /usr/local/lib/python3.1/dist-packages/pymysql
creating /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/test_basic.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/__init__.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/test_issues.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/test_DictCursor.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/test_SSCursor.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/base.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/tests/test_example.py -> /usr/local/lib/python3.1/dist-packages/pymysql/tests
copying build/lib.linux-x86_64-3.1/pymysql/times.py -> /usr/local/lib/python3.1/dist-packages/pymysql
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/connections.py to connections.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/converters.py to converters.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/util.py to util.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/err.py to err.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/charset.py to charset.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/ER.py to ER.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/FLAG.py to FLAG.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/COMMAND.py to COMMAND.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/CLIENT.py to CLIENT.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/constants/SERVER_STATUS.py to SERVER_STATUS.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/cursors.py to cursors.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/test_basic.py to test_basic.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/test_issues.py to test_issues.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/test_DictCursor.py to test_DictCursor.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/test_SSCursor.py to test_SSCursor.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/base.py to base.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/tests/test_example.py to test_example.pyc
byte-compiling /usr/local/lib/python3.1/dist-packages/pymysql/times.py to times.pyc
running install_egg_info
Writing /usr/local/lib/python3.1/dist-packages/PyMySQL3-0.5.egg-info

Percona XtraDB Cluster with python3 mysql

Percona XtraDB Cluster

# aptitude install curl rsync
# curl http://www.percona.com/downloads/RPM-GPG-KEY-percona | apt-key add -

insert /etc/apt/sources.list

deb http://repo.percona.com/apt squeeze main

# aptitude update
# aptitude install percona-xtradb-cluster-client-5.5 percona-xtradb-cluster-server-5.5 percona-xtrabackup

insert /etc/mysql/my.cnf

[mysqld]
binlog_format=ROW
wsrep_provider=/usr/lib64/libgalera_smm.so
wsrep_cluster_address=gcomm://
wsrep_slave_threads=2
wsrep_cluster_name=xtradbClusterTest
wsrep_sst_method=rsync
wsrep_node_name=node1
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2

/etc/init.d/mysql restart

ADD a new mysql cluster node

1. Change “wsrep_node_name” to be unique for every new node
2. Change “wsrep_cluster_address=gcomm://” to “wsrep_cluster_address=gcomm://[ip of a running node]”

copy /etc/mysql/debian.cnf from master node to new node

python3 and MySQL-python

insert /etc/apt/sources.list

# Backports repository
deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free

# aptitude update
# aptitude install python3 python3-pip libmysqlclient-dev python-dev libevent-dev
# easy_install -U distribute
# pip install MySQL-python

EnvironmentError: mysql_config not found

problem

# pip install MySQL-python==1.2.3
Downloading/unpacking MySQL-python==1.2.3
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package MySQL-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/root/build/MySQL-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/root/build/MySQL-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /root/build/MySQL-python
Storing complete log in /root/.pip/pip.log

solved

# aptitude install libmysqlclient-dev