If you did a fresh installation on a new Ubuntu (~18.04) version, you may find that it is not possible to log in to MySQL with its root user, unless you do so as Ubuntu’s root user. Here’s how to fix it:
If you use (You should!) MySQL Prepared Statements, you may not be able to see how the final MySQL queries looks like, within your application, with all the bindings put into place. This is how to view them:
You can use MySQL’s “ON DUPLICATE KEY UPDATE” to insert and update rows when your query faces a “Duplicate Key” error.