Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7948669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:47:21+00:00 2026-06-04T01:47:21+00:00

Access denied for user ‘root’@’localhost’ (using password: YES) I setup a new environment where

  • 0
Access denied for user 'root'@'localhost' (using password: YES)

I setup a new environment where mysql does not have a password and how I am getting this error. Where do I change

'root'@'localhost' (using password: YES)

my database.yml is show below my database is sample_app

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: mysql2
  database: db/development.mysql2
  pool: 5
  timeout: 5000
  database: sample_app
  username: root
  socket: /tmp/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  database: db/test.mysql2
  pool: 5
  timeout: 5000
  database: sample_app
  username: root
  socket: /tmp/mysql.sock

 production:
  adapter: mysql2
  database: db/production.mysql2
  pool: 5
  timeout: 5000
  database: sample_app
  username: root
  socket: /var/run/mysqld/mysqld.sock
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:47:22+00:00Added an answer on June 4, 2026 at 1:47 am

    You should not be using root to connect to a db with an app. Create a new user/password with a name to recognize that it is being used for a specific app\task then use that instead of root.

    add this for empty password password:

    production:
      adapter: mysql2
      database: db/production.mysql2
      pool: 5
      timeout: 5000
      database: sample_app
      username: root
      password:
      socket: /var/run/mysqld/mysqld.sock
    

    If you still get access denied, then the db is saying that the user\password is not valid

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in C:\wamp\www\connect.php on
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O) I've tried
I get the error #1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin give this error. MySQL said: #1045 - Access denied for user 'root'@'localhost' (using
I'm getting Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'username'@'localhost' (using password: NO) Here's
I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO)
Warning for my php file.. Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbuser1'@'localhost This is probably something stupid, but
I have the following error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'root'@'%' to database 'GUEST_BOOK'
I'm using Hibernate with JPA and MySQL. I got accessing denied. java.sql.SQLException: Access denied

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.