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:

Fetch the value of a key from memcache server with telnet

In case you want to fetch the value of a key stored in a memcache you could connect to the memcache server via telnet and query the server for the key:

Connect to the memcache server via telnet:
:$ telnet memcache-server-host 11211

Query for stats slabs and use the slab number t query with cachedump:

stats slabs
STAT 25:chunk_size 21696
STAT 25:chunks_per_page 48

stats cachedump 25 0
ITEM GTLD_DATA [18459 b; 1520683204 s]


Read more:

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

Working with ‘tmux’

Working with ‚tmux‘ enables a number of terminals to be created, accessed, and controlled from a single screen in Unix. The screen can be splitted vertically and horizontally (called panes). Like ’screen‘ tmux can handle different sessions.

Get a list of running, named tmux sessions
~$: tmux ls

Create a new named tmux session
~$: tmux new-session -s [sessionname]

Reopen an existing tmux session
~$: tmux a -t [sessionname]

Shortcuts within a session:
Managing windows
Ctrl+b c: Open/Create a new window within a tmux session
Ctrl+b ,: Rename the current window
Ctrl+b n: Switch to next windows
Ctrl+b p: Switch to previous window
Ctrl+b w: List all windows
Ctrl+b 0-9: Switch to window 0-9 of the tmux session

Managing panes
Ctrl+b %: Split window vertically
Ctrl+b „: Split window horizontally
Ctrl+b arrow key: Switch pane
Hold Ctrl+b, don’t release it and hold one of the arrow keys: Resize pane
Ctrl+b [: Start copy mode. Simply quit with q. PgUp/PgDown lets you scroll up/down.
Ctrl+b q: Show pane numbers
Ctrl+b {: Move current pane left
Ctrl+b }: Move current pane right
Ctrl+b &ltspace>: Toggle through different pane layouts
Ctrl+b !: Break pane into its own window

Ctrl+b : setw synchronize-panes on/off: Synchronize commands to all panes

Managing Session
Ctrl+b $: Rename current session
Ctrl+b d: Detach current session
Ctrl+b &: Kill current session

Ctrl+b :: Open command prompt
Ctrl+b x: Exit terminal
Ctrl+b ?: Help

1: Detaching a session will leave it (and all its windows) but let it run in the background
2: Exit a pane/window will close it and it´s commands.

Download my .tmux.conf

External resources: