Skip to content

Connect Rails to SQLEye

Set DATABASE_URL to the instance’s URL. Rails documents the postgresql adapter for PostgreSQL and mysql2 for MySQL, and a mysql:// URL maps to mysql2.

Terminal window
export DATABASE_URL="postgresql://postgres@127.0.0.1:5432/myapp"
Terminal window
export DATABASE_URL="mysql://root@127.0.0.1:3306/myapp"

Replace the port with your instance’s port. If your client requires a password field, leave it empty.

Create it with the CLI clients before running your migrations.

Source: Rails configuring guide. To spot N+1 loads in your Active Record code, turn on capture.

SQLEye is developed and maintained by CodeROG. This page is also available as Markdown.