MySQL – Fix Error – WordPress Database Error Duplicate Entry for key PRIMARY for Query INSERT INTO wp_options

As many of you know that this blog runs on Wordpress and under the hood of Wordpress there is a MySQL database. MySQL database is quite good and is able to hold massive traffic this blog receives every day. However, just like any database MySQL needs tuning as well as proper management of the same. In this blog post we will discuss about how I received a very weird error Wordpress Database Error and how I resolved it.

Read More

How to Insert Multiple Rows in a Single SQL Query – Interview Question of the Week #069

There are so many different databases in the world and many of them use the language SQL for their programming. It is very easy to assume that if they are using SQL, we can easily use code from one database to another database. Unfortunately the reality is very different, not all the scripts from one database works in another database. Today we will see very interesting question where the user asked a question about inserting multiple rows in a single SQL query.

Read More

MySQL – Different Methods to Know Current User

There are different methods to know the name of the current user in MySQL. There can be many reasons we want to know who is the current user. Here is list of the of the few of the such reasons.

Customized code which we want to run based on the reason.
Checking the permissions based on the user.
Inserting the name of the user in the audit table.
Displaying special message based on the login user.
Executing some special logic/code based on the logged in user.

Read More

MySQL – How to Drop Table If Exists in Database?

In this post SQL Server – 2016 – T-SQL Enhancement “Drop if Exists” clause, we have seen the new feature introduced in SQL Server version 2016. One of my friends recently asked me question that how to drop table in exists in MySQL database? It was not surprising to see that not many people know about the existence of this feature. MySQL already has this feature for a while and if you are MySQL DBA, you may find it interesting that SQL Server just introduced this feature.

Read More
Exit mobile version