GoAdmio

pgloader

Install pgloader, a tool that converts a MySQL/MariaDB database to PostgreSQL

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/pgloader installs pgloader, a command-line tool that copies a MySQL or MariaDB database into PostgreSQL, converting its tables, data types, and rows along the way.

The command installs the package only. It does not convert anything: once it finishes, you run pgloader yourself (see Examples).

It works on AlmaLinux, Rocky Linux, CentOS, Red Hat, Fedora, Debian, and Ubuntu. The command runs sudo internally, so run it as root or as a user with sudo rights, and the server needs internet access.


Quick start

# Install pgloader
/go/pgloader

Syntax

/go/pgloader

The command takes no arguments. Anything you add is written to the command log but otherwise ignored.

Every run is recorded in /var/log/go/pgloader.log, with the time and the arguments you passed.


Options

None.


Output

The command prints no messages of its own. You see only the package manager's output.

Outcome What you get
Supported operating system The installer output for the PostgreSQL repository (RHEL family only) and for pgloader.
Unsupported operating system Nothing. No error is printed and nothing is installed.

The command does not check that the install worked. Run pgloader --version afterward to confirm.

Log

Each run appends one line to /var/log/go/pgloader.log:

[Nov 21 12:00:00]# pgloader

Examples

# Install pgloader
/go/pgloader
# Confirm that it is installed
pgloader --version
# Convert a MySQL/MariaDB database into an existing PostgreSQL database
pgloader mysql://dbuser:dbpass@localhost/olddb postgresql://pguser:pgpass@localhost/newdb

[!WARNING] Passwords typed into a connection address can show up in the process list and in your shell history. Special characters in a password, such as @, :, or /, must be URL-encoded (for example @ becomes %40). For repeated conversions, put the settings in a pgloader command file instead and run pgloader <file>.


Troubleshooting

Symptom Likely cause Fix
Nothing is printed and pgloader isn't installed The operating system isn't one of the supported systems. Install pgloader manually.
The repository install fails on the RHEL family The command downloads the PostgreSQL repository package for Enterprise Linux 8 on x86_64, whatever the server's version or architecture. Install the PostgreSQL repository package that matches your system, then run dnf -y install pgloader.
Unable to locate package pgloader (Debian and Ubuntu) The package index is out of date, or the release doesn't offer pgloader. Run apt update, then run the command again.
pgloader: command not found The install failed. Read the install output for errors and run the command again.
The conversion fails because the target database is missing pgloader doesn't create the PostgreSQL database. Create the database and user first with postgre.
The conversion can't connect to PostgreSQL PostgreSQL isn't installed or running. Install and start it with postgresql.

Details

What it does on each operating system

Operating system Steps
AlmaLinux, Rocky, CentOS, Red Hat, Fedora Installs the PostgreSQL (PGDG) repository package for Enterprise Linux 8 on x86_64 from download.postgresql.org, then installs pgloader with dnf.
Debian, Ubuntu Installs pgloader with apt from the system's own repositories. The command does not run apt update first.
Anything else Does nothing.

Before you convert a database

pgloader copies data from one running database server to another, so before you run it:

To convert a SQL dump file instead of a live database, see mariadb2postgre.


See also

Command Description
postgresql Install and start PostgreSQL
postgre Create, edit, or delete a PostgreSQL database and user
mariadb2postgre Convert a SQL file from MariaDB to PostgreSQL
postgresync Copy PostgreSQL data to a remote server
mysql Create, edit, or delete a MySQL/MariaDB database and user for a hosting account