diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index c33c60db31..ac2e7c7b3e 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -115,8 +115,7 @@ dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall def get_last_insert_id(cursor, table_name, pk_name): - cursor.execute("SELECT LAST_INSERT_ID()") - return cursor.fetchone()[0] + return cursor.lastrowid def get_date_extract_sql(lookup_type, table_name): # lookup_type is 'year', 'month', 'day'