• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 641
  • Last Modified:

Not able to connect to MySQL database.

I am installing OPSI 4 on CentOS 5 server. For that i have to configure mysql. When i trying to connect to mysql i getting following error.

"Failed to connect to host 'localhost' as user 'root' : (1045, "Access denied for user 'root'@'localhost' (using password : NO)")


Please help.
0
vipinvgopal
Asked:
vipinvgopal
2 Solutions
 
Roger BaklundCommented:
You are trying to connect without a password, but a password is required.
0
 
Vijaya Reddy Pinnapa ReddyCommented:
Can you post the mysql query here.
0
 
vipinvgopalAuthor Commented:
I changed root password for mysql. Now its showing following error
Re: Err :1045 Access denied for user 'root@localhost'(using password: YES)

Please help.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Roger BaklundCommented:
The message says it all, this time you are using a password, but not the right one.

Beware that mysql user accounts are identified by user/host combination, i.e. the user 'root@localhost' might have a different password from for instance 'root@192.168.0.1' or 'root@%'.
0
 
InsoftserviceCommented:
check the users table in mysql database.
Check whether you have provided proper users to it or not.
Check what host and user you have assigned. Probably host part has been assigned wrong.
How you are trying to access mysql by which scripting language. check what host you have provided .

http://www.directadmin.com/forum/showthread.php?t=41839&page=1
0
 
brijesh_chauhanCommented:
Hi,

seems like your username and password does not match with each other..

follow these steps to recover you ROOT password.

   1.  Stop MySql server by /etc/init.d/mysqld stop
   2.  Start MySql In safe mode with : mysqld_safe --skip-grant-tables &
   3.  Connect to mysql client using mysql -u root
   4.  select mysql database with : use mysql
   5.  Change the Password of Root with : update user
        set password=password('newpassword') where user='root'
   7.  quit
   8.  Stop mysqld with /etc/init.d/mysqld stop
   9.  Start mysqld with /etc/init.d/mysqld start
  10. restart mysql with new password  

  now you can connect with your MySQL server with root user..
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now