Never use SET GLOBAL sql_slave_skip_counter with a value higher than 1

Posted About 7 years ago by Kim Klotz.

If you have a replication error with MySQL and you know the "error" is okay (e.g. you've executed the same statement at the same time on 2 masters which...

...your second statement is really the next one which would get executed by the MySQL server. Example: you've executed drop database foobar; and drop database blubber; in a row...

Geordi 5.4.0 released

Posted About 3 years ago by Dominik Schöler.

...that checks out a feature branch based on a story from Pivotal Tracker Faster MySQL dumping with --single-transaction and --quick Allow pivotal tracker ids in the global config file...

Fix "libmysqlclient.so.20: cannot open shared object file: No such file or directory"

Posted Over 7 years ago by Tobias Kraze.

This error can be caused by the mysql2 gem under mysterious circumstances. You need to remove it with gem uninstall mysql2 and then reinstall it (or just run bundle).

...pristine mysql2 will not be enough...

ActiveRecord.select

Posted Almost 11 years ago by Andreas Robecke.

Active Record's select method allows you to make use of the power of MySQL select statements. On the one hand it allows you to select specific fields. Post.select("content...

...allows you to include additional data in your models such as the results of MySQL functions. Those function resulst then are accessible like any other attribute of your model. Lets...

Couldn't create database for ...

Posted Over 12 years ago by Dominik Schöler.

...get this error message Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"project_development", "password"=>"topsecret"}, charset: utf8, collation: utf8_unicode_ci (if you set the...

...make sure the user you have specified (root/topsecret) in your database.yml has access to MySQL. You can check this by running mysql -uroot -p...

makandra/gemika: Helpers for testing Ruby gems

Posted Over 7 years ago by Henning Koch.
github.com

...versions (e.g. Ruby 2.1.8, Ruby 2.3.1). Test one codebase against multiple database types (currently MySQL or PostgreSQL). Compute a matrix of all possible dependency permutations (Ruby, gem set, database type...

...does not work with Ruby 2.1). Let developers enter their local credentials for MySQL and PostgreSQL in a database.yml file. Define default Ruby version, gem dependencies and database for developers...

Minidusen: Low-tech record filtering with LIKE queries

Posted Over 7 years ago by Henning Koch.
github.com

...s query parsing and LIKE query functionality. Minidusen can no longer index text in MySQL FULLTEXT columns, which was hardly used and didn't always help performance due to the...

...cost of reindexing. Minidusen is currently compatible with MySQL, PostgreSQL, Rails 3.2, Rails 4.2 and Rails 5.0. Basic Usage Our example will be a simple address book: class Contact < ActiveRecord...

Fix when assigning nested attributes raises "undefined method `to_sym' for nil:NilClass"

Posted About 10 years ago by Henning Koch.

You might have a table without a primary key set in MySQL. You can fix this by adding a primary key index to the guilty MySQL table, or by setting...

Graticule computes NULL distance for some records (and how to fix that)

Posted Over 12 years ago by Arne Hartherz.

...can lead to NULL distances in edge cases. The reason for this is that MySQL is performing several sine and cosine computations which can result in slight rounding errors – which...

...to compute the arc cosine of a result like 1.0000000001. Since this is undefined, MySQL correctly returns NULL (instead of the expected distance of 0 for the circle's center...

Known MariaDB version incompatibilities

Posted Over 4 years ago by Stefan Langenmaier.

MariaDB (and MySQL) is released in different versions with different behaviors. For backwards compatibility this can be managed with the sql_mode option. Following you can find behavior differences which...

PostgreSQL: How to UPDATE multiple attributes with multiple joins

Posted Over 6 years ago by Emanuel.

This is an extension to PostgreSQL vs MySQL: How to UPDATE using a JOIN. UPDATE employees SET department_name = departments.name, department_area = areas.name FROM departments, areas WHERE employees.department_id = departments.id...

We are no longer maintaining Dusen

Posted Over 7 years ago by Henning Koch.
github.com

...to migrate to Minidusen, which extracts those parts from Dusen. Minidusen is compatible with MySQL, PostgreSQL and Rails 3.2, 4.2 and 5.0. If you are looking for a full text...

ActiveRecord subselects - Today I Learned

Posted Almost 8 years ago by Henning Koch.
til.hashrocket.com

...second SELECT statement with a subselect. Note that sub-queries are extremely slow in MySQL, but they can make cases easier where performance does not matter so much (e.g. a...

PostgreSQL: Show size of all databases

Posted Over 8 years ago by Thomas Eisenbarth.

...pg_database ORDER by size_in_mb DESC; Want to see database sizes in MySQL...

Jasmine 2 cheat sheet for RSpec lamers

Posted Over 9 years ago by Henning Koch.

In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you're used to RSpec. Note that Jasmine syntax has changed...

Active Record and PostgreSQL — Ruby on Rails Guides

Posted Over 9 years ago by Arne Hartherz.
edgeguides.rubyonrails.org

...json and array take away a lot of the pain that you had on MySQL projects. Example use cases for array are tags or storing foreign keys (instead of a...

Manually purge binary logs on MariaDB

Posted Almost 10 years ago by Thomas Eisenbarth.

Open a MySQL root shell and use this command: PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND...

howto fix spreewald issue „database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)“

Posted Over 10 years ago.

...Spreewald database.sample.yml has changed) Fix Change cucumber to test in your databse.yml test: # <--- adapter: mysql2 database: spreewald_test encoding: utf8 host: localhost username: root password: password

Scaling Pinterest - From 0 to 10s of Billions of Page Views a Month in Two Years

Posted About 11 years ago by Henning Koch.
highscalability.com

...supported; consistently good performers; failure free as possible; free. Using these criteria they selected: MySQL, Solr, Memcache, and Redis. Cassandra and Mongo were dropped...

Advice: Reduce scopes with joins to simple IN-queries

Posted Over 11 years ago by Henning Koch.

...scope chain, it only mashes together strings that mostly happen to look like a MySQL query in the end. I don't generally advice against using scopes with JOINs. What...

When connecting to a second database, take care not to overwrite existing connections

Posted Almost 12 years ago by Arne Hartherz.

...actually never be written to the database, because we disconnected during an unfinished transaction. MySQL will for good reason not simply commit any open transactions when you disconnect (you might...

Find geocoded records that are close to a location (radius search)

Posted Over 12 years ago by Arne Hartherz.

...as_geocodable using plain Graticule will just do the job. Support from the database MySQL 5 has spatial support. This involves custom data types and funny SQL syntax.

A few hints when upgrading to Ruby 1.9

Posted Almost 13 years ago by Tobias Kraze.

...to you database and database table charsets to UTF8. You can check in the MySQL console with SHOW VARIABLES LIKE "character_set_database"; SHOW TABLE STATUS; Also update your nbsp...

Installing Rails on a fresh system

Posted Almost 13 years ago by Kim Klotz.

...sudo gem install rails -v=2.3.12. You will also need Ubuntu development packages for MySQL, RMagick, etc. The bundle install call will otherwise fail for such projects...