I'm using Ansible to automate the tasks to backup a mysql database and when running the mysql_db
tasks I'm getting this message: msg: the python mysqldb module is required
So, after to many attempts to install python-mysqldb
using Ansible tasks I've tried to install it manually executing the command sudo apt-get install python-mysqldb
and I got the following error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-mysqldb
I'm using Ubuntu 13.04 64bits
What am I doing wrong?
What's the way to install python-mysqldb
using apt-get
?
Python needs a MySQL driver to access the MySQL database. In this tutorial we will use the driver "MySQL Connector". We recommend that you use PIP to install "MySQL Connector".
Fortunately, it is possible to use Ansible to install Python on our server even when it actually depends on it — Ansible provides the raw module which can run basic low-down SSH commands on our server even if Python is not available.
Ubuntu 13.04 has been end-of-lifed for about 10 months. As the link says, "No more package updates will be accepted to 13.04". You should use Ubuntu 12.04 or Ubuntu 14.04, which are LTS (long-term support) versions.
Still, for this specific problem, as @phantom said, use pip.
- pip: name=MySQL-python
(note the capitalization)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With