Creating a database, a table within the database and inserting some values into it in one go
From the title alone, this sounds like something that should not be done, particularly since this is not a lightweight database such as SQLite. Creating the database, its tables, columns, constraints etc. is not, and should not, be the job of the application - but rather an external setup script with administrative permissions. The application, then, should not have such permissions and should only be able to insert/select/update/delete.
For some reason I thought autocommit is enabled by default for the MySQL Python connector, but apparently it's not:
https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html
So your explicit call to commit is fine.
I can't tell from the documentation whether the cursor and connection objects support context management. Try putting both of those in with statements, and if it complains that there's no __enter__, switch to a try/finally that guarantees cursor and connection closure.