Calculate Mysql memory

by Tweak on June 12, 2009
in Mysql

MySQL memory = key_buffer + max_connections * (join_buffer + record_buffer + sort_buffer + thread_stack + tmp_table_size)

OPTIMISING MYSQL

To obtain the stat of your mysql server since it has been loaded, run mysqladmin processlist extended-status as mentionned above.
Read more…

Share and Enjoy:
  • email
  • Print
  • PDF
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • MySpace
  • Live
  • Twitter
  • Yahoo! Buzz

Shell Script To Dump All MySQL Databases Every Hour To NAS Storage

by Tweak on June 12, 2009
in Mysql, Servers

+ Download this script
+ Modify settings according to your setup
+ Install cron job as follows to run script every hour

# Backup database every 1 hr to folder /nas/mysql
@hourly /root/scripts/db1hr.backup.sh >/dev/null 2>&1

Sample Shell Script To Dump All MySQL Databases
Read more…

Share and Enjoy:
  • email
  • Print
  • PDF
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • MySpace
  • Live
  • Twitter
  • Yahoo! Buzz

Backup a database using phpMyadmin

by Tweak on June 8, 2009
in Mysql

Backup of Mysql database
It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.

  1. Open phpMyAdmin.
  2. Click Export in the Menu to get to where you can backup you MySql database. Image showing the export menu.
  3. Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
  4. Select”SQL”-> for output format, Check “Structure” and “Add AUTO_INCREMENT” value. Check “Enclose table and field name with backquotes”. Check “DATA”, check use “hexadecimal for binary field”. Export type set to “INSERT”.
  5. Check “Save as file”, do not change the file name, use compression if you want. Then click “GO” to download the backup file.

Read more…

Share and Enjoy:
  • email
  • Print
  • PDF
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • MySpace
  • Live
  • Twitter
  • Yahoo! Buzz

MySQL Dump and Restore

by Tweak on June 8, 2009
in Mysql

Dump ALL MySQL Databases:

mysqldump –-user=XXXXXXXX -–password=XXXXXXX -A > /PATH/TO/DUMPFILE.SQL

Dump Individual or Multiple MySQL Databases:

mysqldump -–user=XXXXXXXX -–password=XXXXXXX DB_NAME1 DB_NAME2 DB_NAME3 > /PATH/TO/DUMPFILE.SQL
Read more…

Share and Enjoy:
  • email
  • Print
  • PDF
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • MySpace
  • Live
  • Twitter
  • Yahoo! Buzz