MySQL Forums
Forum List  »  Install & Repo

Worked for me: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Posted by: rajesh kaushal
Date: May 30, 2010 07:19PM


I installed mysql.i686 0:5.1.46-1.fc12 on my fedora 12 with command

#yum install mysql mysql-devel mysql-server

Started the mysql server with
# /etc/init.d/mysqld start

When I tried connecting the server with
# mysql -user=root

I got below error. Error message was

ERROR 1045 (28000): Access denied for user 'ser=root'@'localhost' (using password: YES)

My default /etc/my.cnf was like this( it was automatically created when I installed mysql.

# Example MySQL config file for small systems.
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
password = XXXXXX
port = 3306
socket = /var/lib/mysql/mysql.sock

Here follows entries for some specific programs

# The MySQL server
port = 3306
socket = /var/lib/mysql/mysql.sock
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4

In the above file, there was a line "password = XXXXXX" just below [client] heading. where XXXXXX was my root password.

I commented this line in /etc/my.cnf file
#password = XXXXXX

and tried connecting once again. I was connected. After connected you need to change/set/reset your root password for further working.


Options: ReplyQuote

Written By
June 27, 2009 08:29PM
Worked for me: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
May 30, 2010 07:19PM
December 16, 2007 02:18AM
December 27, 2007 02:08PM
January 16, 2011 06:51AM
August 27, 2009 12:22AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.