Category: Databases

How to Install the PostgreSQL Client on Ubuntu 22.04 and 24.04

Whether you’re managing cloud-hosted databases or working in a containerized environment, the PostgreSQL client is an essential tool for developers, sysadmins, and database engineers alike. This article walks you through installing the PostgreSQL client on Ubuntu 22.04 (Jammy Jellyfish) and Ubuntu 24.04 (Noble Numbat)—two of the most widely used LTS releases. What Is the PostgreSQL Client? The PostgreSQL client includes tools like psql, which allow you to connect to PostgreSQL servers, run SQL queries, perform backups, and administer remote databases. It’s commonly installed on application servers, staging environments, and development machines to interact with databases hosted elsewhere. Which Version Should I Install? Both Ubuntu 22.04 and 24.04 come with a default version of PostgreSQL in their package repositories: Ubuntu Version Default PostgreSQL Client Version 22.04 (Jammy) 14 24.04 (Noble) 16 If you’re fine using the default version, installation is straightforward. If you need a newer or specific version, you can

Read More »

How to Set Up a Secure SSH Tunnel for MySQL Access with a Restricted User

Introduction In many scenarios, database servers are not exposed directly to the internet for security reasons. However, developers and applications still need to connect to them securely. One of the best solutions is to create an SSH tunnel that forwards local connections to the remote MySQL server. In this guide, we will: Create a restricted SSH user who can only tunnel and not log in interactively. Use /sbin/nologin to prevent shell access. Set up port forwarding for secure MySQL access. Test and verify the tunnel. Step 1: Create the SSH User On the SSH gateway server, create a dedicated user:

Set a strong password when prompted. Step 2: Restrict the User to SSH Tunneling Only Set the User’s Shell to /sbin/nologin To prevent interactive logins, change the user’s shell:

Restrict the User in SSH Configuration Edit the SSH config file:

Add the following at the bottom:

Read More »

Add Extra MySQL Root User

To add an extra “root” capable MySQL user start by logging in to the server on SSH and connect to MySQL CLI using an existing “root” level account. Next add the new user account:

Next grant permissions:

Now flush the privileges cache:

You might want to double check the results with:

   

Read More »

MySQL – Run Command On All Tables

Here’s a one-liner to run a SQL command on all tables in a database:

Replace “show create table” with the command that you wish to execute. Replace “mydb” with your database name. Replace “root” and “mypassword” with you username and password. Replace “localhost” with your database server hostname or IP address.  

Read More »

Unknown collation: ‘utf8mb4_unicode_ci’

When trying to import MySQL dumps from newer servers to older servers you may get:

or:

The quick and dirty solution is to do a search and replace on the database dump changing “utf8mb4_unicode_ci” and “utf8mb4_unicode_520_ci” to “utf8_unicode_ci”. This can be accomplished with sed:

Read More »

Categories

Get a free consultation from Reliable Penguin

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