Welcome Guest | Login

access denied for user 'root'@'localhost' (using password: NO)?

Hi, I'm a newbie, so forgive me if this is a silly problem.
I've uploaded my site, following the thread http://www.hostingrails.com/forums/wiki_thread/1) on this forum. My first page - a loginpage- works fine, the redirections to the loginpage all work fine, but from the moment I try to login, and try  to make contact with the database, I get a "access denied for user 'root'@'localhost' (using password: NO)" - message. The database.yml is setup correctly, so I must have done something wrong somewhere. Haven't got a clue, and haven't found a solution or cause here on the forum, or on the main Ruby on Rails forum.
Any help would be greatly appreciated.

2007-01-05 04:20 AM

I'm guessing that you need to change the user name from 'root' to a user name you create for the database in question inside of cPanels MySQL management section. The user names (and databases) are created (in the module in cPanel anyway) using your hostingrails.com username and the name you choose to enter in the module.

Here's an example... pretend my user name on the server is 'dura'. If I went into the MySQL DB controls within cpanel, I would see the option to create a new user named 'dura_foo' where 'foo' is a field of my choosing. If I was setting up a database for, say, Joomla, I'd probably name the database 'joomla' (the DB would be named 'dura_joomla') and I'd choose 'joomla' for the user name as well (so it would be 'dura_joomla' for a user name). Don't forget to set a password for your database users! I hope this helps you a bit... if you need more help post your question(s)!

Seth



2007-01-05 02:09 PM

Seth
Thanks for your reply, Seth.
That is exactly what I did. I made the database, added a user, and did put the correct database_name and database_user in the database.yml file, not root. That is what is puzzling me. I can get in my database in the terminal with that name and password, but when I want to do that from my loginpage, I get a message that I am trying to log in as user root.
Another problem now is that my loginpage won't come up anymore. I now get the message that rails won't start correctly, although I haven't changed a thing. When I originally posted the message, it worked, now it doesn't anymore. I can install everything once more, but I allready have done that a few times, and I always end up at the same problem.
I really don't know what to do next.
Rudy

2007-01-05 02:20 PM

Are you using 'localhost' for the data base hostname? Also, being you changed the database and database user names, does that information need to be put in a configuration file some where for your application? It sounds like either something is trying to use the wrong host for the database or something is still trying to use 'root' for a user name to access the database. Also, when you're in your browser (cPanel) try pressing 'ctrl+f5' (control and F5) to clear your browsers cache... I've had trouble with that as well. Nothing like spending 2-3 hours on a problem only to realize it was all due to browser/proxy cache. :)

Seth

2007-01-05 03:23 PM

Seth
Right - and you can also kill off your dispatch.fcgi - and check these threads for the most resent error:
http://www.hostingrails.com/forums/wiki_thread/15http://www.hostingrails.com/forums/wiki_thread/9

If you're still having problems let us know.

Cheers,

~William

2007-01-05 04:50 PM

Thanks for the replies.
I started all over again, and logged what I did. This is it.

1. Deleted map with program, shortcut, renamed public_html, deleted databases and dbuser.
2. Created database again, user, assigned user to database with cpanel
3. Dumped my databasedata in the database via import in phpMyAdmin.
4. Changed database.yml into
production:
 adapter: mysql
 database: [my_hostingrails_username]_[my_database_name]
 username: [my_hostingrails_username]_[my_database_username]
 password: my_password

and uncommented    ENV['RAILS_ENV'] ||= 'production'  in the environment.rb

5. changed the .htaccess file (dispatch.cgi => dispatch.fcgi) and commented out the Addhandlerfastcgi-script at the top of that file.

6. Generated my app with rails my_app via terminal at the root-level
7. Replaced the app-folder with my app-folder through ftp.
8. Uploaded my images-, styles- and javascriptsfolders.
9. Left the dispatch.cgi and dispatch.fcgi-files as they are.
10. Replaced .htaccesfile
11. Replaced database.yml and environment.rb.
12. Changed routes.rb so that  map.connect '', :controller => "my_main_controller_name" was in place, and uploaded the file.
13. Deleted the index.file in my public folder.
14. Created the symbol link.
15. Cleared the cache from 3 browsers.
16. Had a sneakpeak at my hostrailsaccount with all three.

Result =>errormessage =  Rails application failed to start properly

17. Had a look at my production.log => empty
18. Tried     killall -usr1 dispatch.fcgi   in the terminal. Response was several lines "operation not permitted", ending with a no process killed.
19. Remembered reading something about setting permissions for the dispatchfiles in another thread. Did a  
[~/railsapp/public]# chmod 755 disp*
20 Tried the application again. => Same result.

I must be overlooking something.

Thanks for helping.

Rudy

2007-01-06 03:54 AM

Hi there I went ahead and took a look at your account.  I noticed that your database.yml file had two spaces before the 'production' - I removed that and it seems to be working.  Also, I turned off ActiveRecord session stores, we'd prefer you to use your app's filesystem (its faster and takes less system resources).  

Cheers,

~William

2007-01-06 07:05 AM

Briljant! Thanks ever so much. This kind of help makes all the difference.

cheers
Rudy

2007-01-06 07:22 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.