Extract a single database from a dump file of all databases
GRANT SELECT,INSERT,UPDATE,DELETE,ALTER,INDEX,CREATE,DROP ON database.* TO user@'10.1.1.%' IDENTIFIED by 'password';
echo "Starting MySQL"
cd /usr/local/mysql; ./bin/safe_mysqld --user=mysql &
echo "Starting MySQL 4"
cd /usr/local/mysql-4; ./bin/mysqld_safe --user=mysql -L ./share/mysql/english &
MySQL < 4.0 /etc/my.cnf:
[mysqld]
set-variable = max_connections=400
set-variable = wait_timeout=60
innodb_file_per_table
MySQL >= 4.0 /etc/my.cnf:
[mysqld]
old_passwords = 1
max_connections = 400
wait_timeout = 180
skip-name-resolve
bind-address = 127.0.0.1
innodb_file_per_table
====== Upgrade MySQL script ======
#!/bin/bash
OLD=mysql-3.23.36-pc-linux-gnu-i686
NEW=mysql-3.23.58-pc-linux-i686
set -x
killall mysqld
sleep 5
cd /usr/local
rsync -axvP --update --delete --exclude=\*.err $OLD/data/ $NEW/data/
rm -f mysql
ln -s $NEW mysql
cd /usr/local/mysql; ./bin/safe_mysqld --user=mysql &
====== Extract a single database from a dump file of all databases ======
sed '1,/^-- Current Database: `targetdb`$/d;/^-- Current Database: /,$d' full-Thursday.sql