Rostyslav Rava - Personal Website

Recent Posts

How to Change a User Password in MySQL

Changing a MySQL user password is always a good idea. It is often done periodically for credential rotation. It can also respond to compromised credentials, for example, when a password is committed by mistake to a code repository.

First, identify the user whose password needs to be changed. In MySQL, users are identified by a username and the host from which they are allowed to connect. In most cases, the host is % (any host) or localhost.

Configure a local HTTP proxy to a Java application with Apache on Ubuntu 26.04 LTS

Suppose the local development app is served on the domain application.local, with the following entry in /etc/hosts:

127.0.0.1 application.local

Usually a web-based Java application runs on port 8080, with a local URL like http://application.local:8080/.

To reach that app at http://application.local without the port, configure Apache as a reverse proxy. Create a virtual host file under /etc/apache2/sites-available/, for example application.conf, with the following content:

<VirtualHost *:80>
    ServerName application.local
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

ProxyPreserveHost On forwards the browser’s Host header (application.local) to the backend instead of 127.0.0.1:8080. That usually matches what Java apps expect for host-based routing, redirects, and generated URLs. If something breaks, try removing this line or set ProxyPreserveHost Off so the backend sees the origin it was configured for.

How to fix MySQL APT EXPKEYSIG B7B3B788A8D3785C

When attempting to upgrade packages from the MySQL APT repository:

sudo apt update

The error below may appear when you run sudo apt update.

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mysql.com/apt/ubuntu focal InRelease: The following signatures were invalid: EXPKEYSIG B7B3B788A8D3785C MySQL Release Engineering <mysql-build@oss.oracle.com>
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Connection failed [IP: 2a06:bc80:0:1000::17 80]
W: Failed to fetch http://repo.mysql.com/apt/ubuntu/dists/focal/InRelease  The following signatures were invalid: EXPKEYSIG B7B3B788A8D3785C MySQL Release Engineering <mysql-build@oss.oracle.com>

The cause is an expired signing key. The quickest fix is to reinstall the MySQL APT configuration package (mysql-apt-config). Download the .deb from MySQL’s APT repository.

How to Install MySQL 8.4 on RHEL 7

While both Red Hat Enterprise Linux and Ubuntu are Linux systems, the installation process for MySQL from the YUM repository is completely different from what was described earlier for MySQL on Ubuntu. Although RHEL 7 reached end of maintenance on June 30, 2024, it will still be under Extended Life Cycle Support until May 31, 2029. That is more than three years away, which makes it a suitable option for legacy bare-metal servers that list it as a supported operating system.

How to Remove Leading, Trailing, and Extra Spaces in MySQL

During an in-depth review of large processed datasets, it is often possible to find that they contain multiple extra space characters. There may be thousands of them in data stored in a single text field. Multiplied by millions of rows, they create additional load on the system without adding any value to the processed data.

In general, there are three cases where blank spaces may appear. The most common is at the beginning of the string. These can usually be removed with the LTRIM function.