Archive for the ‘MySQL’ Category

MySQL backup script

Slightly modified MySQL backup script. This one uses mysqlhotcopy. It only locks the tables for 1 or 2 seconds (every two hours in cron). Then it copies the database MyISAM files. These files then are being archived and compressed, and copied to NAS using SMB. Advantage of this new principle is that MySQL is only [...]

http benchmark

To stress test our servers we’re benchmarking them. By monitoring both the webservers and database we can tune our setup and see where the performance bottleneck is located. To properly test the website we need to take a “snapshot” from the requests that are performed on the webservers. To do that, we make a log [...]

Install a MySQL server from debian source package

Quick code overview to compile a debian mysql5 server package, and to install it. ?View Code BASH1 2 3 4 5 6 7 apt-get install libdbi-perl libdbd-mysql-perl apt-get build-dep mysql-server apt-get -b source mysql-server dpkg -i mysql-common_..all.deb dpkg -i mysql-client-..i386.deb dpkg -i mysql-server-..i386.deb mysqladmin -u root password ‘yourpassword’ It might also be required to integrate [...]

Exporting and importing MySQL database

Quick way to do this via commandline: export: ?View Code BASH1 mysqldump -u Username -pPassword DatabaseName > DatabaseName_backup.sql import: ?View Code BASH1 mysql -u Username -pPassword DatabaseName < DatabaseName_backup.sql

Creating a MySQL database with proper rights.

Sometimes it’s easy to create a database without any specific permissions, to test some scripts on. The way to do this is: ?View Code BASH1 2 3 4 CREATE USER ‘testuser’@'localhost’ IDENTIFIED BY ‘pass’; GRANT USAGE ON * . * TO ‘testuser’@'localhost’ IDENTIFIED BY ‘pass’; CREATE DATABASE IF NOT EXISTS `testDB` ; GRANT ALL PRIVILEGES [...]