Changes between Version 36 and Version 37 of InstallationGuidelines/MySQL


Ignore:
Timestamp:
09/06/10 19:15:53 (11 years ago)
Author:
Fran Boon
Comment:

Admin section inc Backups

Legend:

Unmodified
Added
Removed
Modified
  • InstallationGuidelines/MySQL

    v36 v37  
    7979Possibly useful tips:
    8080 * http://20bits.com/articles/10-tips-for-optimizing-mysql-queries-that-dont-suck/
     81
     82== Administration ==
     83Command line access:
     84{{
     85mysql -u root -p
     86<password>
     87show databases;
     88\r <database>
     89show tables;
     90select *;
     91}}}
     92Dump a database to a text file (for import into another server):
     93{{{
     94mysqldump <database> > <database>.sql
     95}}}
     96Restore:
     97{{{
     98mysqladmin --user=root create <database>
     99mysql <database> < <database>.sql
     100}}}
     101or
     102{{{
     103mysql -p
     104create DATABASE <database>;
     105\u <database>
     106\. <database>.sql
     107}}}
     108
     109=== Backups ===
     110http://sourceforge.net/projects/automysqlbackup
     111{{{
     112cp automysqlbackup-2.5.1-01.sh /root/automysqlbackup.sh
     113chmod +x /root/automysqlbackup.sh
     114vi /root/automysqlbackup.sh
     115USERNAME=root
     116PASSWORD=<password>
     117DBHOST=localhost
     118DBNAMES="sahana"
     119BACKUPDIR="/var/spool/mysql"
     120}}}
     121or:
     122 * Use mysqlshow to extract all MySQL database names
     123 * Then mysqldump to export each database to an individual flat file.
     124
    81125== Troubleshooting ==
    82126Can view the list of expensive queries by editing /etc/mysql/my.cnf and uncommenting/adding: