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...

guides.rubyonrails.org

...will resemble your database's EXPLAIN style. For example, it looks like this on MySQL: User.where(id: 1).includes(:articles).explain EXPLAIN for: SELECT `users`.* FROM `users`  WHERE `users`.`id...

...server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? Connection to the MySQL database does not work anymore Your travis-ci builds might have started failing on the...

mysql -e 'create database IF NOT EXISTS minidusen_test;' with an error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) The command "mysql...

So you got this error, even though your Gemfile bundles mysql2: !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' or Please install the mysql adapter: `gem install...

...activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.) The reason for this confusing error message is probably that your Gemfile says mysql2, but your...

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...

...on the server (ls -l). In our case, it's 1234567890. Know your (local) MySQL root password. We'll use SECRET below. Know your (local) target database name. For us...

...my_project_development. Go wild: ^ ssh user@example.com "cat /mnt/dumps/my_project.dump.bz2" | pv -s 1234567890 | bzip2 -d | mysql -uroot -pSECRET my_project_development That will: Print the (bzipped) file to stdout on the...

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, but forgot to...

...rebuild your MySQL gems. Try fully removing and re-installing the gem: gem uninstall mysql mysql2 bundle install

makandra dev

...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...

...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...

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...

...If necessary (i.e. the tests use databases), add a spec/support/database.github.yml file with this content: mysql: database: test username: root password: password host: 127.0.0.1 port: 3306 postgresql: database: test host: localhost...

...version that is actually in the matrix. You might run into issues with the mysql2 gem, including issues bundling, and even segfaults. Use this card to fix these issues.

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...

...thought. While you can call ActiveRecord::Base.connection.execute(sql) to execute arbitrary SQL commands, the MySQL connection is configured to only accept a single statement per query. If you try to...

...error in your SQL syntax. You can work around this by opening a second MySQL connection that does accept multiple statements per call. Below is an example for a migration...

We upgraded a Rails 2 application to Rails 3.2 and Ruby 2.1, changed the mysql adapter from mysql to mysql2, but did not activitate the asset pipeline. Instead we used...

makandra dev
github.com

...working directory and ~/dumps (for dumps created with geordi). geordi drop_databases Delete local MySQL/MariaDB and Postgres databases that are not whitelisted. Authentication is handled via PAM for Postgres and...

...MariaDB, via .my.cnf with fallback to mysql -p for MySQL. Different connection methods can be chosen via command line switches, e.g. for cleaning up multiple local database server installations in...

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...

If you have many connections to your MySQL or MariaDB (as we have) you might want to filter the list you see when running a SHOW PROCESSLIST. To hide all...

There is an more advanced way by querying the information_schema database: Show MySQL process list without sleeping connections

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...

You can however make your database.yml work for mysql and mysql2 at the same time. Simpy do this production: adapter: <%= defined?(Mysql2) ? 'mysql2' : 'mysql...

makandra dev

...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...

makandra dev

...the Rails 2.3.8 gem." you forgot to bundle Rails. If you see "Missing the mysql gem", bundle that as well. Add both Gemfile as well as Gemfile.lock to the repository...

...NUMBER'] %> appended to the database name in the test section. # ./config/database.yml ... test: &TEST adapter: mysql database: my_database_name_test<%= ENV['TEST_ENV_NUMBER'] %> encoding: utf8 username: xxx password: yyy...

...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...

...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.

makandra dev

...e.g. rails console staging Gem updates Replace ruby-debug with byebug or pry Replace mysql with mysql2, '< 0.3' Remove oniguruma Remove net-ssh and net-scp Remove fastercsv Remove cucumber...