Problem: phpmyadmin interfaces are slow and often attacked by script kids, if you can don’t use it!
Solution: To backup and restore use command line
To Backup a database:
$mysqldump -u root -p wordpressdb > /backups/wordpressdb-dump.sql [Enter root password]
To restore:
$mysql -u root -p wordpressdb < /backups/wordpressdb-dump.sql[Enter root password]
Remark: this is not recogized by the ONLINE SYSTEM if users visits you pages to read! There must be no shutdown of the mysql or apache webserver, its a online HOT-Dump. If you like put it into a script and set cron to backup every night.
Sample Bash MySQL Script for full automatic dumps:
#!/bin/bash
## automatic dump database and add time and date stamp ##
date=`date +%d%m%Y-%H%M` # set current date value
mysqldump wordpressdb > /backups/wordpressdb-$date.sql # save+date
exit # close script after work
To save all Databases on one MySQL-Server change
mysqldump --all-databases > /backups/server-all-$date.sql
now run
#crontab -e
set time to run:
@daily sh /scriptpath/backup-databases.sh > /dev/null 2>&1
This runs daily backup at 00:00AM and post no message to Admin (root) if you need mails remove (>…1)
MySQL, Wordpress Help
|
automatic, backup, cron, dump, hot, mysql, night, realtime, restore, script, without phpmyadmin, wordpress
Problem: If you use wordpress and edit often your posts a high count of old revisions are backuped inside the mysql database:
Solution:
Login mysql
$mysql -u root -p [Enter root password]
at mysql command line select wordpress your database
mysql>use wordpressdb; [Enter]
System echo=Database changed..
delete old backups of posts
mysql>DELETE FROM wp_posts WHERE post_type = "revision"; [Enter]
System echo=..Entry affected time..
logout database and revisit pages, if you have made a database backup with mysqldump before and after cleanup you see how much size the database lost (du -h wordpress.sql)
often 80% of the size.
MySQL, Wordpress Help
|
backup, cleanup, database, mysql, old entry, posts, revision, size, speedup, wordpress
On SME Server:
Data Path which are saved by Console Backup
- save all Custom-Scripts which you run with Cron or Root at Location /root
- save all modified Custom Templates at /etc/e-smith/templates-custom
- all ibays
- all /home
- if you not know how to make /etc/e-smith/templates-custom files copy the standard
templates from /etc/e-smith/templates to /etc/e-smith/templates-custom and modify them there
don’t forget to run after customize:
#signal-event post-upgrade
and
#signal-event reboot
Problem:
On SME Server the HAL Daemon often not recognize a USB Stick or Disk
which you can use for “Console” Backup Program.
Solution:
- Create a Script with #nano /root/backup.sh
- insert:
- service haldaemon restart
- service messagebus restart
- console
- exit
This restart the HAL Environment before Console (SSH-Admin-Tool)is opened.
To prevent Users to write on the Shares if you run the Backup you can add:
- service haldaemon restart
- service messagebus restart
- service smb stop
- console
- service smb start
- exit
This will stop Samba-Windows Shares! and prevent File-Access-Lockwaits!