Forum: Ruby on Rails 'Access Denied' - unable to load schema into production DB

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
05e65b4e54a4695a916e1dcea2de72e6?d=identicon&s=25 Eu Reka (eureka)
on 2008-12-22 20:15
I am currently stuck on how to proceed.  This app is hosted on site5.
mysql version 4.1 I believe.  I posted this on their forums, and also on
mysql forums.  Is anyone able to confirm whether it's a rails issue or
not, or mysql, or something with the web hosting server.

I can't load my schema into my rails production DB. I'm hoping this is a
simple problem.

- I Created mysql database called batman_production.

- I Created a user Joker with ALL privileges granted to
batman_production.

- I can log into mysql with -u Joker and the correct password. I can see
'batman_production' when I type 'show databases;'.

- I then exit mysql and go into my rails app folder and run:

'rake db:schema:load RAILS_ENV=production'. I then get 'Access denied
for user 'Joker'@'localhost' to database 'batman_production'.

I double-checked the database.yml file and it has Joker's credentials.


Any suggestions on where to proceed from here? Thank you!
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-12-22 20:46
(Received via mailing list)
On Mon, Dec 22, 2008 at 11:15 AM, Eu Reka
<rails-mailing-list@andreas-s.net> wrote:
>
> I am currently stuck on how to proceed.  This app is hosted on site5.
> mysql version 4.1 I believe.

> 'rake db:schema:load RAILS_ENV=production'. I then get 'Access denied
> for user 'Joker'@'localhost' to database 'batman_production'.
>
> I double-checked the database.yml file and it has Joker's credentials.

My immediate WAG would be password length discrepancy:

Note this from the old mysql-default-database.yml --

# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html

Now on your production system, log into mysql and enter

mysql> show variables like '%pass%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| old_passwords | OFF   |
+---------------+-------+
1 row in set (0.07 sec)

mysql>

If that says ON, you have an issue :-)

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
05e65b4e54a4695a916e1dcea2de72e6?d=identicon&s=25 Eu Reka (eureka)
on 2008-12-23 01:34
Hassan Schroeder wrote:
> On Mon, Dec 22, 2008 at 11:15 AM, Eu Reka
> <rails-mailing-list@andreas-s.net> wrote:

> If that says ON, you have an issue :-)


Thanks for your reply.
I ran the command you suggested and it's set to off:



mysql> show variables like '%pass%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| old_passwords | OFF   |
+---------------+-------+
1 row in set (0.00 sec)
05e65b4e54a4695a916e1dcea2de72e6?d=identicon&s=25 Eu Reka (eureka)
on 2008-12-23 01:57
I managed to solve the problem.  It seems my database.yml was missing
two characters in the database name in both production and development.
The host I am using automatically adds a prefix to both database name
and user name.  Once I corrected the names in my database.yml, recreated
the user, and re-granted permissions, I was able to complete the
migration.
This topic is locked and can not be replied to.