INSTALL 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. ====================
  2. MySQLdb Installation
  3. ====================
  4. .. contents::
  5. ..
  6. Prerequisites
  7. -------------
  8. + Python 2.3.4 or higher
  9. * http://www.python.org/
  10. * Versions lower than 2.3 WON'T WORK.
  11. * 2.4 is the primary test environment.
  12. * Red Hat Linux:
  13. - Make sure you have the Python development headers and libraries
  14. (python-devel).
  15. + setuptools
  16. * http://pypi.python.org/pypi/setuptools
  17. + MySQL 3.23.32 or higher
  18. * http://www.mysql.com/downloads/
  19. * Versions lower than 3.22 definitely WON'T WORK.
  20. * Versions lower than 3.22.19 might not work.
  21. * MySQL-3.22 might work but isn't supported anymore. It's very old.
  22. * MySQL-3.23 ought to work, but it's pretty elderly.
  23. * MySQL-4.0 is supported, but not tested and slightly discouraged.
  24. * MySQL-4.1 is supported. The prepared statements API is not
  25. supported, and won't be until MySQLdb-1.3 or 2.0, if ever.
  26. * MySQL-5.0 is supported and tested, including stored procedures.
  27. * MySQL-5.1 is supported (currently a release candidate) but untested.
  28. It should work.
  29. * MySQL-6.0 is sorta-kinda-supported (currently alpha) but untested.
  30. It should work.
  31. * Drizzle <https://launchpad.net/drizzle> is a fork of MySQL. So far
  32. the C API looks really similar except everything is renamed.
  33. Drizzle support probably won't happen in 1.2. There may be have to
  34. be an entirely different module, but still using DB-API.
  35. * MaxDB, formerly known as SAP DB (and maybe Adabas D?), is a
  36. completely different animal. Use the sapdb.sql module that comes
  37. with MaxDB.
  38. * Red Hat Linux packages:
  39. - mysql-devel to compile
  40. - mysql and/or mysql-devel to run
  41. * MySQL.com RPM packages:
  42. - MySQL-devel to compile
  43. - MySQL-shared if you want to use their shared
  44. library. Otherwise you'll get a statically-linked module,
  45. which may or may not be what you want.
  46. - MySQL-shared to run if you compiled with MySQL-shared installed
  47. * Transactions (particularly InnoDB tables) are supported for
  48. MySQL-3.23 and up. You may need a special package from your vendor
  49. with this support turned on.
  50. + zlib
  51. * Required for MySQL-3.23 and newer.
  52. * Red Hat Linux
  53. - zlib-devel to compile
  54. - zlib to run
  55. + openssl
  56. * May be needed for MySQL-4.0 or newer, depending on compilation
  57. options. If you need it, you probably already have it.
  58. - you may need openssl-devel on some platforms
  59. + C compiler
  60. * Most free software-based systems already have this, usually gcc.
  61. * Most commercial UNIX platforms also come with a C compiler, or
  62. you can also use gcc.
  63. * If you have some Windows flavor, you usually have to pay extra
  64. for this, or you can use Cygwin_.
  65. .. _Cygwin: http://www.cygwin.com/
  66. Building and installing
  67. -----------------------
  68. The setup.py script uses mysql_config to find all compiler and linker
  69. options, and should work as is on any POSIX-like platform, so long as
  70. mysql_config is in your path.
  71. Depending on which version of MySQL you have, you may have the option
  72. of using three different client libraries. To select the client library,
  73. edit the [options] section of site.cfg:
  74. embedded
  75. use embedded server library (libmysqld) if True; otherwise use
  76. one of the client libraries (default).
  77. threadsafe
  78. thread-safe client library (libmysqlclient_r) if True (default);
  79. otherwise use non-thread-safe (libmysqlclient). You should
  80. always use the thread-safe library if you have the option;
  81. otherwise you *may* have problems.
  82. static
  83. if True, try to link against a static library; otherwise link
  84. against dynamic libraries (default). You may need static linking
  85. to use the embedded server.
  86. Finally, putting it together::
  87. $ tar xfz MySQL-python-1.2.1.tar.gz
  88. $ cd MySQL-python-1.2.1
  89. $ # edit site.cfg if necessary
  90. $ python setup.py build
  91. $ sudo python setup.py install # or su first
  92. Windows
  93. .......
  94. I don't do Windows. However if someone provides me with a package for
  95. Windows, I'll make it available. Don't ask me for help with Windows
  96. because I can't help you.
  97. Generally, though, running setup.py is similar to above::
  98. C:\...> python setup.py install
  99. C:\...> python setup.py bdist_wininst
  100. The latter example should build a Windows installer package, if you
  101. have the correct tools. In any event, you *must* have a C compiler.
  102. Additionally, you have to set an environment variable (mysqlroot)
  103. which is the path to your MySQL installation. In theory, it would be
  104. possible to get this information out of the registry, but like I said,
  105. I don't do Windows, but I'll accept a patch that does this.
  106. On Windows, you will definitely have to edit site.cfg since there is
  107. no mysql_config in the MySQL package.
  108. Zope
  109. ....
  110. If you are using a binary package of Zope, you need run setup.py with
  111. the python executable that came with Zope. Otherwise, you'll install
  112. into the wrong Python tree and Zope (ZMySQLDA) will not be able to
  113. find _mysql.
  114. Binary Packages
  115. ---------------
  116. I don't plan to make binary packages any more. However, if someone
  117. contributes one, I will make it available. Several OS vendors have
  118. their own packages available.
  119. RPMs
  120. ....
  121. If you prefer to install RPMs, you can use the bdist_rpm command with
  122. setup.py. This only builds the RPM; it does not install it. You may
  123. want to use the --python=XXX option, where XXX is the name of the
  124. Python executable, i.e. python, python2, python2.4; the default is
  125. python. Using this will incorporate the Python executable name into
  126. the package name for the RPM so you have install the package multiple
  127. times if you need to support more than one version of Python. You can
  128. also set this in setup.cfg.
  129. Red Hat Linux
  130. .............
  131. MySQL-python is pre-packaged in Red Hat Linux 7.x and newer. This
  132. includes Fedora Core and Red Hat Enterprise Linux. You can also
  133. build your own RPM packages as described above.
  134. Debian GNU/Linux
  135. ................
  136. Packaged as `python-mysqldb`_::
  137. # apt-get install python-mysqldb
  138. Or use Synaptic.
  139. .. _`python-mysqldb`: http://packages.debian.org/python-mysqldb
  140. Ubuntu
  141. ......
  142. Same as with Debian.
  143. Gentoo Linux
  144. ............
  145. Packaged as `mysql-python`_. ::
  146. # emerge sync
  147. # emerge mysql-python
  148. # emerge zmysqlda # if you use Zope
  149. .. _`mysql-python`: http://packages.gentoo.org/search/?sstring=mysql-python
  150. BSD
  151. ...
  152. MySQL-python is a ported package in FreeBSD, NetBSD, and OpenBSD,
  153. although the name may vary to match OS conventions.
  154. License
  155. -------
  156. GPL or the original license based on Python 1.5.2's license.
  157. :Author: Andy Dustman <andy@dustman.net>
  158. :Revision: $Id$