0

I need to have access to my vbulletin forum database on other server than my rails app. I created vbulletin entry in database.yml

vbulletin:
  adapter: mysql2
  encoding: latin2
  database: db_name
  username: username
  password: password
  host: forum.hostname.pl
  port: 3306

And created simple model vbuser.rb

class Vbuser < ActiveRecord::Base
  establish_connection(:vbulletin)
  self.table_name = 'user'
end

Now, I'm trying run Vbuser.last in console but get : Mysql2::Error: Can't connect to MySQL server on 'forum.hostname.pl' (110)

What can be the problem?

1
  • Using an admin console, can you connect to the database with the details you've got in your database.yml? Commented Mar 7, 2013 at 13:24

1 Answer 1

1

Two reasons I can think of -:Either you have supplied incorrect details, or the host does not allow you to directly connect. Don't think it's a Rails specific issue. Can you do a quick check on some other language (php etc) and see if you are able to connect? Your syntax seems fine to me.

To quickly check create a connect.php file on localhost.

In that file

<?php
$link=mysqli_connect('host','user','pwd','database') or die("can't connect");
if ($link)
echo "Working";
mysqli_close($link);
?>

What do you get?

Sign up to request clarification or add additional context in comments.

2 Comments

just run telnet forum.hostname.pl 3306 and get Trying xxx.xxx.xxx.xxx ... telnet: Unable to connect to remote host: Connection timed out. Just waiting for my admin info, maybe he blocks external connections? ps. your script gives the same result Can't connect to MySQL. At least I know it's not Rails problem, thanks.
Problem was both db user priviliges and firewall settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.