0) Backup your database.
You should probably be doing this already. Now’s a good time to make sure that your backups ran.
1) Create the script.
You’ll need the correct permissions to query the database. Here’s the command. Be sure to change <DATABASE_NAME> as it fits.
# mysql -p -e “show tables in <DATABASE_NAME>;” | \
tail –lines=+2 | [...]
Posted on July 11th, 2010 by Denie
Filed under: BASH, CentOS, Linux, MySQL, Tutorials | 2 Comments »
/usr/local/bin/mysql.backup.sh
#!/bin/bash
NOW=$(date +”%m-%d-%Y”)
OLD=$(date +”%m-%d-%Y” –date=”3 days ago”)
PROJECT=”project_name”
LOCATION=”/home/backup”
FILE=”$PROJECT.$NOW.sql”
FILE2=”$FILE.gz”
FILEOLD=”$PROJECT.$OLD.sql.gz”
EMAIL=”youremail@domain.com”
$SQLUSER=”username”
$SQLPASS=”password”
$SQLNAME=”database_name”
cd $LOCATION ; \
rm -f $FILEOLD ; \
mysqldump -u $SQLUSER –password=$SQLPASS $SQLNAME > \
$LOCATION/$FILE ; \
gzip $LOCATION/$FILE ; \
echo “Backup location is in $LOCATION/$FILE2″ | \
mail -s “[$PROJECT] MySQL Backup” $EMAIL
Then you can put it on your cron (background process)
Below cron will execute the script on Saturday at 12AM:
0 0 [...]
Posted on July 4th, 2010 by Denie
Filed under: BASH, Linux, MySQL | No Comments »
By default, Apache comes preconfigured to serve a maximum of 256 clients simultaneously. This particular configuration setting can be found in the file /etc/httpd/conf/httpd.conf
If your server has 2 GB of RAM, and you’re sharing your server with MySQL(true in my case), you’ll want to reserve about half of it for Apache (1 GB)
Posted on July 25th, 2009 by Denie
Filed under: Apache, Linux, MySQL, Tutorials | No Comments »
To setup Master-Slave Replication the first thing you need to do is create a user on the Master server that allows replication.
Posted on June 8th, 2009 by Denie
Filed under: MySQL | 2 Comments »