-
-
Save KarelWintersky/b80f4d44cee2f223cde01239dbcddaa2 to your computer and use it in GitHub Desktop.
Debian GNU/Linux MySQL-MariaDB autologin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################## | |
# MySQL | MariaDB autologin | |
# License: GNU GPL v3+ | |
# Author: Valerio Bozzolan | |
######################################## | |
file=/etc/mysql/debian.cnf | |
while [ -z "$user" ] && read ln; do | |
[[ "$ln" =~ user\ *=\ (.*)$ ]] | |
user="${BASH_REMATCH[1]}" | |
done < $file | |
while [ -z "$pass" ] && read ln; do | |
[[ "$ln" =~ password\ *=\ (.*)$ ]] | |
pass="${BASH_REMATCH[1]}" | |
done < $file | |
mysql --user="$user" --password="$pass" $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment