diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py index 1b67fc8615a..d0e27e6f440 100644 --- a/django/core/db/backends/mysql.py +++ b/django/core/db/backends/mysql.py @@ -110,8 +110,7 @@ class DatabaseWrapper(local): return "`%s`" % name 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'