Skip to content

Instantly share code, notes, and snippets.

@kucaahbe
Last active January 17, 2022 12:05
Show Gist options
  • Save kucaahbe/c22895bcc73ff393ac0e814bdd254c8a to your computer and use it in GitHub Desktop.
Save kucaahbe/c22895bcc73ff393ac0e814bdd254c8a to your computer and use it in GitHub Desktop.
rails db -p use mycli as MySQL client (shell wrapper for https://www.mycli.net/)
#!/bin/bash
# usage:
# save this file into $HOME/bin/mysql (don't forget to make it executable)
# and make sure $HOME/bin is in PATH environment variable before folder where original mysql binary is located.
# for instance mysql binary is here: /usr/local/bin/mysql, than PATH should be like:
# /home/user/bin:/usr/local/bin:...
set -e
declare -a args=()
for arg in "$@"; do
# exclude unsupported --default-character-set=... option
[[ "$arg" =~ ^--default-character-set= ]] && continue
args+=("$arg")
done
exec mycli "${args[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment