1Sep/110
The 5 Biggest Ways to Boost MySQL Scalability
Sean Hall with some really good MySQL advice:
- Tune those queries. Biggest bang for your buck. Enable the slow query log and watch it. Once you've found a heavy resource intensive query, optimize it! Tune what receives real-world traffic.
- Employ Master-Master Replication. Immediately have a read-only slave for your application to hit as well.
- Use Your Memory. Set innodb_buffer_pool_size, key_buffer_size and other key options.
- RAID Your Disk I/O. Use RAID 10 mirroring and striping. On EC2 striping across a number of EBS volumes using the Linux md software raid.
- Tune Key Parameters. speeds up inserts & updates with innodb_flush_log_at_trx_commit=2; create a tablespace and underlying datafile for each table with innodb_file_per_table.
Full details at the original article.
15Nov/100
MySQL Import and Export
Here are few MySQL Queries/commands that i regularly use for exporting and importing MySQL data. This is for my reference, but just thought this might be useful for newbies.
MySQL Table Data Export and Import
- To export the just table data please use the following query
SELECT * INTO OUTFILE 'data.txt' FIELDS TERMINATED BY ',' FROM mytable;
- To import the csv file into table execute the following SQL Query.
LOAD DATA INFILE 'data.txt' INTO TABLE mytable FIELDS TERMINATED BY ',';
Copy the contents of one database to another
- First, create the new database
create database db2;
- Then, from the command-line, do the following to copy the contents from db1 to db2.
$ mysqldump -u root --password=pass db1 | mysql -u root --password=pass db2
MySQL Dump
- To export the MySQL database into a dump file, please execute the following command
$ mysqldump -u root --password=pass db1 > dbdump.sql
Create MySQL User
- Creating MySQL user and granting access
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'myuser'; GRANT ALL ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'myuser';


