mysqltuner.pl
This Perl script will run diagnostics on your MySQL database and recommend changes to your MySQL configuration.
Related cards:
Use DatabaseCleaner with multiple test databases
There is a way to use multiple databases in Rails.
You may have asked yourself how you're able to keep your test databases clean, if you're running multiple databases with ful...
MySQL: Careful when using database locks in transactions
We tend to use database transactions as a magic bullet to get rid of all our concurrency problems. When things get really bad, we might even throw in some locking [mechanism](https://makandracards...
Mysql/Mysql2 agnostic database.yml
If you upgrade to the mysql2 gem, you will run into the problem that the server's database.yml (which is usually not under version control) needs to change exactly on deploy.
You can however make your database.yml work for mysql and mysql2 at the...
Delete all MySQL records while keeping the database schema
You will occasionally need to clean out your database while keeping the schema intact, e.g. when someone inserted data in a migration or when you had to kill -9
a frozen t...
UTF-8ify an existing MySQL database
First do
ALTER DATABASE database_name CHARACTER SET "utf8";
ALTER DATABASE database_name COLLATE "utf8_unicode_ci";
After that, for each table:
ALTER TABLE table_name DEFAULT CHARACTER SET "utf8" COLLATE "utf8_unicode_ci";
This jus...
uninitialized constant MysqlCompat::MysqlRes (NameError)
If you get a stacktrace complaining about uninitialized constant MysqlCompat::MysqlRes
a system library update might broke your gem.
You might have [switched from MySQL to MariaDB](https://makandracards.com/makandra/51171-running-rails-2-apps-w...
MySQL: How to clone a database
Here is a way to create a duplicate of one database, with all its tables and their data, under a new name.
-
Make a dump of your source database:
mysqldump -uroot -p my_project -r my_project.sql
Or, if you only want to dump the datab...
List sizes of MySQL databases
Do you wonder which databases are actually taking up how much space but only have one huge ibdata1
in your /var/lib/mysql
and the directories inside your mysql data directory don't represent the actual database sizes? This is for you!
Run fro...
Performance analysis of MySQL's FULLTEXT indexes and LIKE queries for full text search
When searching for text in a MySQL table, you have two choices:
- The LIKE operator
- [FULLTEXT](http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html...
MySQL 5.1: Switch to InnoDB Plugin for better performance
MySQL version 5.1 comes with an alternative, faster InnoDB implementation (called "InnoDB Plugin").
Switching is easy:
- Stop your mysqld with
sudo stop mysql
- Add the following lines to your
/etc/mysql/my.cnf
under the[mysqld]
section
...