On Python 2, bytearray represents binary data. On Python 3, bytes and bytearray represents binary data. reference: https://github.com/go-sql-driver/mysql/pull/382 https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-46.html https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-27.html