all : fix inputrc + mysql : add createdb script

This commit is contained in:
a-sansara 2016-07-29 15:22:12 +02:00
parent 775cfba38c
commit 300de09c5a
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
dbname=${1:-''}
dbuser=${2:-''}
echo "dbname : $dbname"
echo "dbuser : $dbuser"
tfile=`mktemp`
if [ ! -f "$tfile" ]; then
return 1
fi
if [ ! -z "$dbname" ]; then
cat <<EOF > $tfile
CREATE DATABASE IF NOT EXISTS \`$dbname\` CHARACTER SET utf8 COLLATE utf8_general_ci;
EOF
if [ ! -z "$dbuser" ]; then
cat <<EOF >> $tfile
GRANT ALL ON \`$dbname\`.* to '$dbuser'@'localhost';
GRANT ALL ON \`$dbname\`.* to '$dbuser'@'%';
EOF
fi
echo "FLUSH PRIVILEGES;" >> $tfile
cat $tfile;
mysql -uroot < $tfile
rm -f $tfile
fi

View File

@ -0,0 +1,13 @@
# Keyboard shortcut : Ctrl+x followed by desired key
# refresh without bash logout : bind -f ~/.inputrc
cat <<EOF > /etc/inputrc
"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left
"\e[1~": beginning-of-line # home
"\e[3~": delete-char # delete
"\e[4~": end-of-line # end
"\e[5~": history-search-backward # page-up
"\e[6~": history-search-forward # page-down
EOF
bind -f /etc/inputrc