Category: Databases

Fixing PostgreSQL Client/Server Version Mismatches with Docker

One of the most common headaches for engineers working with PostgreSQL is a version mismatch between the client tools (psql, pg_dump, pg_restore, etc.) installed on a host and the actual Postgres server they need to manage. For example: Your Ubuntu box ships with psql 12.17… but your database is running Postgres 16. You need to restore a dump created by pg_dump 16.1, but your host only has pg_restore 13.14. Installing the correct client from apt repositories can be a hassle, especially if you don’t want to add extra repos or upgrade the entire Postgres server stack. The good news? There’s a simple workaround: use the official Postgres Docker images as a source of up-to-date client binaries. Why client versions matter PostgreSQL is generally backwards compatible, but not always. Client tools expect certain dump formats and GUC parameters that may not exist in older/newer servers: A pg_restore from v12 may fail

Read More »

Installing `mongorestore` on Ubuntu 22.04

When working with MongoDB, the mongorestore utility is an essential tool for restoring databases from BSON dump files. On Ubuntu 22.04, mongorestore is included in the MongoDB Database Tools package, which is distributed separately from the MongoDB server. This guide walks you through the installation process step by step. Step 1: Import the MongoDB Public GPG Key Before adding the MongoDB repository, you need to import its public GPG key:

Step 2: Add the MongoDB APT Repository Add the MongoDB repository to your system’s APT sources:

Step 3: Update the Package List Update the local package index to include the new MongoDB repository:

Step 4: Install the MongoDB Database Tools Install the tools package, which includes mongorestore along with other utilities such as mongodump, mongoimport, and mongoexport:

Step 5: Verify the Installation Confirm that mongorestore is installed and available on your system:

You should see

Read More »

Fixing MySQL DEFINER Errors on AWS RDS (Trigger Import)

When importing a MySQL dump into Amazon RDS, you might hit an error like:

In the dump you’ll often see a trigger, view, or routine created with a DEFINER that doesn’t match your current user, for example:

On RDS you typically don’t have SUPER (legacy) or SET_USER_ID (modern) privileges, so MySQL refuses to create the object with someone else’s DEFINER. TL;DR (the quick, safe fix) Strip the DEFINER=… clauses from the dump so MySQL defaults to the importing user.

Notes The versioned comments like /*!50017 … */ are fine to keep. Removing only the DEFINER=… text is enough. On macOS, use sed -E -i ” ‘s/…/…/g’ file.sql (empty string after -i). Alternative: keep an explicit definer (without elevated privileges) If you prefer to keep an explicit definer, rewrite to CURRENT_USER:

CURRENT_USER is allowed in object definers and avoids the privilege requirement. Why this happens (in one

Read More »

Fixing MySQL 8 Import Error: NO_AUTO_CREATE_USER in sql_mode

When importing a MySQL 5.7 (or older) dump into MySQL 8.0, the process can fail with:

This article explains why it happens and shows safe, repeatable fixes you can apply immediately. TL;DR (One‑liner fix) Strip the deprecated token from the dump as you import it:

Replace DB_HOST, DB_USER, and DB_NAME to match your environment. Why this error appears Older dumps often contain version‑gated statements like:

NO_AUTO_CREATE_USER was removed in MySQL 8.0. Attempting to include it in sql_mode causes MySQL to abort the import with ERROR 1231. The behavior controlled by NO_AUTO_CREATE_USER no longer exists in 8.0 (user creation and grants were redesigned), so it’s safe to remove the token. Solution A — Clean the dump, then import (recommended) Locate the offending token

Remove it everywhere (preserve the rest of the sql_mode list and clean up commas):

Import the cleaned dump

Why this is preferred

Read More »

Enabling TLS for CodeIgniter (MySQLi) on Amazon RDS

Transport Layer Security (TLS) encrypts traffic between your app and database, protecting credentials and data in transit. This guide shows how to enable and verify TLS for a CodeIgniter 4 app using the MySQLi driver against Amazon RDS/Aurora MySQL—whether you have root on the host or not. It also covers enforcing TLS at the database and common pitfalls. What you’ll do Download the Amazon RDS CA bundle Point CodeIgniter’s MySQLi connection at that CA Verify the connection is encrypted (with either MySQL or MariaDB clients) Optionally require TLS at the DB parameter group level 1) Get the Amazon RDS CA bundle Use either the global bundle (works for all commercial regions) or a region-specific bundle (e.g., us-east-1). Global (covers any commercial region): https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem Regional example (N. Virginia): https://truststore.pki.rds.amazonaws.com/us-east-1/us-east-1-bundle.pem With root (system-wide location)

Without root (per-site location, safe for Plesk)

Sanity checks:

Plesk note: if PHP has open_basedir

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.