OpenHalo: PostgreSQL Now Speaks MySQL Wire Protocol!

PostgreSQL speaking MySQL? Yes, you read that right. OpenHalo, freshly open-sourced on April Fools’ Day, brings this capability to life - allowing users to read, write, and manage the same database using both MySQL and PostgreSQL clients. Built on PG 14.10, it provides MySQL 5.7 wire protocol compatibility.

OpenHalo just open-sourced their MySQL-compatible PG kernel. I’ve packaged it into RPMs and integrated it into Pigsty. The deployment is butter-smooth, and after a few code tweaks, it plays nicely with HA, monitoring, and backup components.

openhalo.png

On the DB-Engines ranking, five databases stand head and shoulders above the rest: Oracle, SQL Server, MySQL, PostgreSQL, and MongoDB.

db-engine.png

Here’s the kicker - PostgreSQL can now emulate all four of its top competitors:

Fun fact: All these capabilities are available out-of-the-box in Pigsty.


Want to Try It Out?

Pigsty now supports OpenHalo on EL systems. Here’s how to get started:

Follow the Pigsty standard installation process with the mysql config template:

curl -fsSL https://repo.pigsty.cc/get | bash; cd ~/pigsty
./bootstrap              # Prepare dependencies
./configure -c mysql     # Use MySQL (OpenHalo) template
./install.yml           # Install (modify passwords in pigsty.yml for prod) 

Pro tip: For production deployments, modify the passwords in pigsty.yml before running the installation playbook.

OpenHalo’s configuration mirrors PostgreSQL’s. You can use psql to connect to the postgres database and mysql CLI to connect to the mysql database.

all:
  children:
    pg-orio:
      vars:
        pg_databases:
        - {name: postgres ,extensions: [aux_mysql]}
  vars:
    pg_mode: mysql                    # MySQL Compatible Mode by HaloDB
    pg_version: 14                    # The current HaloDB is compatible with PG Major Version 14
    pg_packages: [ openhalodb, pgsql-common, mysql ]   # also install mysql client shell
    repo_modules: node,pgsql,infra,mysql
    repo_extra_packages: [ openhalodb, mysql ] # replace default postgresql kernel with openhalo packages

MySQL’s default port is 3306, and when accessing MySQL, you’re actually connecting to the postgres database. Note that MySQL’s “database” concept maps to PostgreSQL’s “schema”. So use mysql actually uses the mysql schema in the postgres database.

MySQL credentials mirror PostgreSQL’s - manage users and permissions the PostgreSQL way. Currently, OpenHalo officially supports Navicat, though IntelliJ IDEA’s DataGrip might throw some tantrums.

mysql -h 127.0.0.1 -u dbuser_dba

Pigsty’s OpenHalo fork includes some QoL improvements over HaloTech-Co-Ltd/openHalo:

  • Default database renamed from halo0root to postgres
  • Version number simplified from 1.0.14.10 to 14.10
  • MySQL compatibility and port 3306 enabled by default

Disclaimer: Pigsty provides no warranty for OpenHalo - direct support queries to the original vendor.


More Kernel Tricks Up Our Sleeve

OpenHalo isn’t the only PG fork Pigsty supports. Check out:

BTW, my friend Yurii, Omnigres founder, is working on ETCD protocol support for PostgreSQL. Soon you might be able to use PG as a beefed-up etcd for Kubernetes/Patroni.

kernels.png

Best part? All this goodness is open-source and ready to roll in Pigsty. Want to take OpenHaloDB for a spin? Grab a server, and you’re 10 minutes away from finding out if it lives up to the hype.




Last modified 2025-04-09: add two blog (ffc9843)