MySQL: Drop All Triggers from a Database

I got the error “Trigger already exists” error while I was re-importing a MySQL database. A solution to this problem is to create DROP queries for all the Triggers of the database. SELECT Concat('DROP TRIGGER ', Trigger_Name, ';') FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = 'your_database_name'; This will print out the DROP statements for all the triggers. … Read more

Magento 2: Enable Database/MySQL Query Log

MySQL database query logging can be enabled/disabled from command line. This will help in debugging database queries. Enable database query logging The following CLI command enabled database/mysql query log: bin/magento dev:query-log:enable Flush cache bin/magento cache:flush After that, browse your Magento site. The database queries logs are saved in the file var/debug/db.log. Note: The database query … Read more

Set up PHP Development Environment with Docker

This article shows how you can set up a PHP development environment using Docker. We will be installing PHP, MySQL & Nginx, and PHPMyAdmin in the docker containers. Here’s a basic introduction to docker and docker tools & terminologies: Introduction to Docker and its Tools & Terminologies. Pre-requisites Docker should be installed on your machine: … Read more

[SOLVED] ERROR 2006 (HY000): MySQL server has gone away

This article provides the solution to the following MySQL error: ERROR 2006 (HY000): MySQL server has gone away We generally get this kind of error when we try to import or insert a large volume of data into the MySQL database. To solve this error, we can: – either update the MySQL’s configuration file: my.cnf … Read more

Node.js, MySQL & Express: Simple Add, Edit, Delete, View (CRUD)

This article shows how you can create a simple CRUD (Create, Read, Update, Delete) application in Node.js using MySQL as database. We will also be using Express Framework to build this Node.js web application. We will be using EJS as templating engine. We will be using HTTP Methods like GET, PUT, POST, DELETE to make … Read more

PHP MySQL: Simple CRUD (Add, Edit, Delete, View) using PDO

This article shows how to create a CRUD (Create, Read, Update, Delete) application in PHP & MySQL using PHP Data Objects (PDO). PDO is a PHP extension that provides an interface for accessing databases in PHP. PDO is portable and powerful. There are many good features of PDO. The best one is that it’s cross-database … Read more