MySQL

Let’s learn how MySQL can be used.

We'll cover the following

History

MySQL is a very popular open source database backend. We can connect to it with Python in several different ways. For example, we could connect to it using one of the ODBC methods we mentioned in the previous lessons. One of the most popular ways to connect to MySQL with Python is the MySQLdb package. There are actually a couple of variants of this package:

  • MySQLdb1
  • MySQLdb2
  • moist

The first is the traditional way to connect to MySQL with Python. However, its development is just now in maintenance and won’t be receiving any new features. The developers switched to doing MySQLdb2 and then transformed that into the moist project. MySQL had a rift occur after they were bought by Oracle and it ended up getting forked into a project called Maria. So now there is Maria, MySQL and another fork called Drizzle that are all based on some portion of the original MySQL code. The moist project attempts to create a bridge we can use to connect to all three of these backends, although it’s still a bit in the alpha or beta stages at the time of publication. To make things extra confusing, MySQLdb is a wrapper around _mysql, which we can use directly if we want to.

Get hands-on with 1400+ tech skills courses.