What’s the difference between MySQLdb, mysqlclient and MySQL connector/Python?

MySQLdb is a thin python wrapper around C module which implements API for MySQL database. There was MySQLDb1 version of wrapper used some time ago and now it is considered to be a legacy. As MySQLDb1 started evolving to MySQLDb2 with bug fixes and Python3 support, a MySQLDb1 was forked and here is how mysqlclient … Read more

Visibility of global variables in imported modules

Globals in Python are global to a module, not across all modules. (Many people are confused by this, because in, say, C, a global is the same across all implementation files unless you explicitly make it static.) There are different ways to solve this, depending on your actual use case. Before even going down this … Read more

Python mysqldb: Library not loaded: libmysqlclient.18.dylib

I solved the problem by creating a symbolic link to the library. I.e. The actual library resides in /usr/local/mysql/lib And then I created a symbolic link in /usr/lib Using the command: sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib so that I have the following mapping: ls -l libmysqlclient.18.dylib lrwxr-xr-x 1 root wheel 44 16 Jul 14:01 libmysqlclient.18.dylib … Read more

mysql_config not found when installing mysqldb python interface

mySQLdb is a python interface for mysql, but it is not mysql itself. And apparently mySQLdb needs the command ‘mysql_config’, so you need to install that first. Can you confirm that you did or did not install mysql itself, by running “mysql” from the shell? That should give you a response other than “mysql: command … Read more

pip install mysql-python fails with EnvironmentError: mysql_config not found

It seems mysql_config is missing on your system or the installer could not find it. Be sure mysql_config is really installed. For example on Debian/Ubuntu you must install the package: sudo apt-get install libmysqlclient-dev Maybe the mysql_config is not in your path, it will be the case when you compile by yourself the mysql suite. … Read more

Installing specific package version with pip

TL;DR: pip install -Iv (i.e. pip install -Iv MySQL_python==1.2.2) What these options mean: -I stands for –ignore-installed which will ignore the installed packages, overwriting them. -v is for verbose. You can combine for even more verbosity (i.e. -vv) up to 3 times (e.g. -Ivvv). For more information, see pip install –help First, I see two … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)