MySQL

Create User

user=
password=
db_to_grant=
host=localhost  # alternatively '%' to allow access from an outside client
sudo mysql << EOF
CREATE USER '$user'@'localhost' IDENTIFIED BY '$password';
GRANT ALL PRIVILEGES ON $db_to_grant . * TO '$user'@'$host';
EOF

# test
mysql -u $user --password=$password -D $db_to_grant

MySQL on Ramdisk

Install:

mkdir -p /dev/shm/mysql/data
cd /dev/shm/mysql

mysql_install_db --datadir=/dev/shm/mysql/data

mysqladmin -S /dev/shm/mysql/socket --port=9002 -u root password toor

defaults.conf:

[mysqld]
user      = felix
socket    = /dev/shm/mysql/socket
port      = 9002
basedir   = /usr
datadir   = /dev/shm/mysql/data
tmpdir    = /dev/shm/mysql/tmp
skip-external-locking

bind-address    = 0.0.0.0

key_buffer    = 16M
max_allowed_packet  = 16M
thread_stack    = 192K
thread_cache_size       = 8

myisam-recover         = BACKUP

thread_concurrency     = 6

query_cache_limit = 1M
query_cache_size = 16M

#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
log_error                = /dev/shm/mysql/error.log

log_slow_queries  = /dev/shm/mysql/mysql-slow.log
long_query_time = 1
#log-queries-not-using-indexes

[isamchk]
key_buffer    = 16M

start server:

mysqld --defaults-file=/dev/shm/mysql/defaults.conf

client:

mysql --socket=/dev/shm/mysql/socket --port=9002 -u root -p

MySQL Workbench Keyring KDE

From http://tuxrocket.com/archives/tinker/1725:

sudo apt-get install libpam-gnome-keyring
cat<<'EOF' > /etc/pam.d/common-pamkeyring
auth optional pam_gnome_keyring.so try_first_pass
session optional pam_gnome_keyring.so auto_start
EOF
echo '@include common-pamkeyring' >> /etc/pam.d/kdm