Skip to content

Commit d65e10e

Browse files
gvoyseymethane
authored andcommitted
Add note about annoying MySQL Connector bug. (PyMySQL#212)
1 parent b948553 commit d65e10e

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

README.md

+30-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,44 @@ I hope this fork is merged back to MySQLdb1 like distribute was merged back to s
1313

1414
You may need to install the Python and MySQL development headers and libraries like so:
1515

16-
`sudo apt-get install python-dev libmysqlclient-dev` # Debian / Ubuntu
16+
* `sudo apt-get install python-dev libmysqlclient-dev` # Debian / Ubuntu
17+
* `sudo yum install python-devel mysql-devel` # Red Hat / CentOS
18+
* `brew install mysql-connector-c` # macOS (Homebrew) (Currently, it has bug. See below)
1719

18-
`sudo yum install python-devel mysql-devel` # Red Hat / CentOS
19-
20-
On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC.
20+
On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC.
2121

2222
#### Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :
2323

2424
`sudo apt-get install python3-dev` # debian / Ubuntu
2525

2626
`sudo yum install python3-devel ` # Red Hat / CentOS
2727

28-
`brew install mysql-connector-c` # macOS (Homebrew)
28+
#### **Note about bug of MySQL Connector/C on macOS**
29+
30+
See also: https://bugs.mysql.com/bug.php?id=86971
31+
32+
Versions of MySQL Connector/C may have incorrect default configuration options that cause compilation errors when `mysqlclient-python` is installed. (As of November 2017, this is known to be true for homebrew's `mysql-connector-c` and [official package](https://dev.mysql.com/downloads/connector/c/))
33+
34+
Modification of `mysql_config` resolves these issues as follows.
35+
36+
Change
37+
38+
```
39+
# on macOS, on or about line 112:
40+
# Create options
41+
libs="-L$pkglibdir"
42+
libs="$libs -l "
43+
```
44+
45+
to
46+
47+
```
48+
# Create options
49+
libs="-L$pkglibdir"
50+
libs="$libs -lmysqlclient -lssl -lcrypto"
51+
```
52+
53+
An improper ssl configuration may also create issues; see, e.g, `brew info openssl` for details on macOS.
2954

3055
### Install from PyPI
3156

setup_posix.py

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# of mysql_config
1010

1111
def dequote(s):
12+
if not s:
13+
raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?")
1214
if s[0] in "\"'" and s[0] == s[-1]:
1315
s = s[1:-1]
1416
return s

0 commit comments

Comments
 (0)