I am trying to migrate a MySQL db to Postgres.
From what I've read online, it seems like pgloader
is the best tool for this.
Background:
I installed pgloader
with apt-get
, but ran into an error when running the migration:
$ pgloader mysql://root:<password>@localhost/state_migrations postgresql:///state_migrations
ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) as user "root": Condition QMYND:MYSQL-UNSUPPORTED-AUTHENTICATION was signalled.
I solved that issue by changing the security permissions for MySQL as suggested by these questions:
- pgloader - Failed to connect to mysql at "localhost" (port 3306) as user "root": Condition QMYND:MYSQL-UNSUPPORTED-AUTHENTICATION was signalled
- https://github.com/dimitri/pgloader/issues/782#issuecomment-502323324
That appears to have worked, but then I ran into this error when running the migration command:
pgloader ERROR mysql: 76 fell through ECASE expression.
I found this issue on Github and it seems a couple of people had success after installing pgloader
from source instead of apt-get
.
Current issue:
This guide helped me figure out how to install from source, but the make pgloader
command is bringing me to what I think is a lisp prompt and I'm not understanding what I need to do...
make pgloader
mkdir -p build
curl -o build/quicklisp.lisp http://beta.quicklisp.org/quicklisp.lisp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 57144 100 57144 0 0 389k 0 --:--:-- --:--:-- --:--:-- 387k
sbcl --noinform --no-sysinit --no-userinit --load build/quicklisp.lisp \
--load src/getenv.lisp \
--eval '(quicklisp-quickstart:install :path "build/quicklisp" :proxy (getenv "http_proxy"))' \
--eval '(quit)'
==== quicklisp quickstart 2015-01-28 loaded ====
To continue with installation, evaluate: (quicklisp-quickstart:install)
For installation options, evaluate: (quicklisp-quickstart:help)
WARNING: Making quicklisp part of the install pathname directory
debugger invoked on a SB-BSD-SOCKETS:OPERATION-TIMEOUT-ERROR in thread
#<THREAD "main thread" RUNNING {1004BD8173}>:
Socket error in "connect": ETIMEDOUT (Connection timed out)
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE] Ignore runtime option --eval "(quicklisp-quickstart:install :path \"build/quicklisp\" :proxy (getenv \"http_proxy\"))".
1: [ABORT ] Skip rest of --eval and --load options.
2: Skip to toplevel READ/EVAL/PRINT loop.
3: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(SB-BSD-SOCKETS:SOCKET-ERROR "connect" 110)
error finding frame source: Bogus form-number: the source file has probably
changed too much to cope with.
source: NIL
0]
The output stops for a bit after saying it is Making quicklisp part of the install pathname directory
, but then it times out eventually.
I have tried entering (quicklisp-quickstart:install)
, but it keeps timing out.
0] (quicklisp-quickstart:install)
debugger invoked on a SB-BSD-SOCKETS:OPERATION-TIMEOUT-ERROR in thread
#<THREAD "main thread" RUNNING {1004BD8173}>:
Socket error in "connect": ETIMEDOUT (Connection timed out)
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT ] Reduce debugger level (to debug level 1).
1: [CONTINUE] Ignore runtime option --eval "(quicklisp-quickstart:install :path \"build/quicklisp\" :proxy (getenv \"http_proxy\"))".
2: Skip rest of --eval and --load options.
3: Skip to toplevel READ/EVAL/PRINT loop.
4: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(SB-BSD-SOCKETS:SOCKET-ERROR "connect" 110)
error finding frame source: Bogus form-number: the source file has probably
changed too much to cope with.
source: NIL
0[2]
- Ubuntu 22.04.2 LTS
- psql (PostgreSQL) 14.7 (Ubuntu 14.7-0ubuntu0.22.04.1) (installed with
sudo apt install postgresql postgresql-contrib
apt-get
installed: pgloader "3.6.3~devel" compiled with SBCL 2.1.11.debian- When building pgloader from source, I was installing 3.6.9 (latest release)
The instructions for building from source aren't very descriptive from pgloader, but they're:
Install the build dependencies first, then use the Makefile:
$ apt-get install sbcl unzip libsqlite3-dev make curl gawk freetds-dev libzip-dev
$ cd /path/to/pgloader
$ make save
$ ./build/bin/pgloader --help
Because I've never installed from source before or used make
, I followed this guide since it installs from source: https://www.digitalocean.com/community/tutorials/how-to-migrate-mysql-database-to-postgres-using-pgloader#step-2-installing-pgloader