Ruby on Rails
MySQL (Version #153)


see: http://dev.mysql.com/doc/mysql/en/What-is.html

From mysql_adapter.rb

“The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based MySQL adapter that comes bundled with Active Record, and with the faster C-based MySQL/Ruby adapter”

MySQL Adapters

The pure Ruby MySQL adapter doesn’t work with MySQL 4.1 or 5.x

Note: In the install instructions there is a step

ruby ./test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]

You can do this instead: Create a db called “test”. You do not have to create any tables. Then enter:

ruby ./test.rb <host> <user> <pass>

which will test the new module.

Note: If you are connecting to a MySQL 4.1 or 5.x database, you will need to use the C MySQL adapter.

Troubleshooting

“ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:)” Error

In Rails 1.0’s version of the pure Ruby adapter, this problem occurs for users created in certain way. It could be solved by recreating users using the “CREATE USER” sql syntax. This problem didn’t exist in 0.13.1 and it surprises you as soon as you upgrade to 1.0. Many topics like the one below suggest changing the driver to Native Mysql one, but try this user recreation first.

If you’re using MySQL 4.1 and you can’t get any queries to work, see MySQL Database access problem.

Blob related issues

If you’re using MySQL 3.X, and you’re getting SQL syntax errors using BLOBs, see MySQL 3 and Rails.

“No such file or directory” issue

If you’re using the Ruby based adapter, Ruby/MySQL, and you get a message like: “No such file or directory – /tmp/mysql.sock” you might like to try editing the value of MYSQL_UNIX_ADDR in the active_record/vedor/mysql.rb file to point at your mysql.sock file. Because I had installed lampp, mine was in opt/lampp/var/mysql/

Alternatively, you may find it easier to create a symlink:

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

Resources

Category:DatabaseDrivers


see: http://dev.mysql.com/doc/mysql/en/What-is.html

From mysql_adapter.rb

“The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based MySQL adapter that comes bundled with Active Record, and with the faster C-based MySQL/Ruby adapter”

MySQL Adapters

The pure Ruby MySQL adapter doesn’t work with MySQL 4.1 or 5.x

Note: In the install instructions there is a step

ruby ./test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]

You can do this instead: Create a db called “test”. You do not have to create any tables. Then enter:

ruby ./test.rb <host> <user> <pass>

which will test the new module.

Note: If you are connecting to a MySQL 4.1 or 5.x database, you will need to use the C MySQL adapter.

Troubleshooting

“ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query:)” Error

In Rails 1.0’s version of the pure Ruby adapter, this problem occurs for users created in certain way. It could be solved by recreating users using the “CREATE USER” sql syntax. This problem didn’t exist in 0.13.1 and it surprises you as soon as you upgrade to 1.0. Many topics like the one below suggest changing the driver to Native Mysql one, but try this user recreation first.

If you’re using MySQL 4.1 and you can’t get any queries to work, see MySQL Database access problem.

Blob related issues

If you’re using MySQL 3.X, and you’re getting SQL syntax errors using BLOBs, see MySQL 3 and Rails.

“No such file or directory” issue

If you’re using the Ruby based adapter, Ruby/MySQL, and you get a message like: “No such file or directory – /tmp/mysql.sock” you might like to try editing the value of MYSQL_UNIX_ADDR in the active_record/vedor/mysql.rb file to point at your mysql.sock file. Because I had installed lampp, mine was in opt/lampp/var/mysql/

Alternatively, you may find it easier to create a symlink:

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

Resources

Category:DatabaseDrivers