Mac: Lokaler Docker MySQL Server verbinden

Um lokal einen MySQL Server mit Docker zu starten und sich anschließend über einen weiteren MySQL Docker Container mittels MySQL Client zu verbinden, müssen sich beide Container im selben (Docker-)Netzwerk befinden.
Dies kann u.a. erreicht werden, indem beim Starten des zweiten Containers, das Netzwerk des ersten Containers angegeben wird.

Am Beispiel von MySQL 5.7

docker run --name local-mysql57 -e MYSQL_ROOT_PASSWORD=topsecret -d mysql:5.7

docker run -it --network container:local-mysql57 --rm mysql:5.7 mysql -h127.0.0.1 -uroot -p

Siehe auch:
https://hub.docker.com/_/mysql
https://docs.docker.com/network/#container-networks

Embedded MariaDB4j unable to load openssl lib 1.0.0 (Mac OS Catalina)


On my Mac (Mac OS Catalina 10.15.3), after a `brew update & brew upgrade` the openssl lib was updated from 1.0 to 1.1.

Sadly, the embedded MariaDB(j) I‘m using for Java Application UnitTests seems currently not to be compatible with opelssl 1.1.

Caused by: ch.vorburger.exec.ManagedProcessException: Program [/.../MariaDB4j/base/bin/mysql_install_db, ...) failed, exitValue=1, last 100 lines of console:
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /private/var/folders/ws/b6yxxmzj3hb20lkqndwws27r0000gp/T/MariaDB4j/base/bin/my_print_defaults
Reason: image not found

A similar issue reported here: https://github.com/vorburger/MariaDB4j/issues/48 and more specific in a comment from January 19th https://github.com/vorburger/MariaDB4j/issues/48#issuecomment-573946677

My (temporary) solution was to switch openssl back to lastest 1.0:
$ brew switch openssl 1.0.2t
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t

How to fetch field(s) from MySQL query result in bash


In case you want to fetch/export the result of a mysql query into a text file, but you don´t have the option to use the OUTFILE command you can simple use the following bash command:

:~$ mysql -u USER -p PASSWORD -h HOST --silent --skip-column-names -e 'select field1, field2, field3 from table' > query-result.csv