Results 1 to 7 of 7
  1. #1

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

    Im trying to setup a mysql server on my centos vps server. Ive installed mysql server and done chkconfig and the mysql server has started. My problems start when i want to set a mysql root password.

    mysqladmin -u root password yourrootsqlpassword
    mysqladmin -h -u root password yourrootsqlpassword
    I get an error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"

    Which i totally dont understand because why would it want a password when im trying to set the password???????

  2. #2
    Join Date
    Jul 2009
    Charlotte, NC
    Are you sure you didn't already set a password? You can do the following to reset it if you have:

    /etc/init.d/mysqld stop
    mysqld_safe --skip-grant-tables &
    mysql -u root
    mysql> use mysql;
    mysql> update user set password=PASSWORD("newrootpassword") where User='root';
    mysql> flush privileges;
    mysql> quit
    /etc/init.d/mysqld stop
    /etc/init.d/mysqld start

  3. #3
    um let me get back to you on that. I broke yum and now im reimaging the server.

  4. #4
    Join Date
    Jun 2006
    Re-imaging because yum broke?

    Anyway as eeg3 mentioned, try resetting the password otherwise this could be a permissions issue. What are the logs showing?
    FiberPeer.Com | | REAL DDoS Protection | Cloud Hosting | VPS | Dedicated Servers | High Bandwidth Hosting | 1Gbps-10Gbps Unmetered
    FiberPeer DDoS Mitigation | ethProxy Upgraded! | 14-Years Experience | Emergency 24/7 Support
    Visit us @

  5. #5
    $ mysql --user=root -p

    Enter password:

    Try this .Hopefully it should work

  6. #6
    Join Date
    Apr 2004
    Quote Originally Posted by tpirate5 View Post
    mysqladmin -u root password yourrootsqlpassword
    Your command sytax was incomplete. You already have a root password set. As such, to change this password, you must also provide the current password to set a new one.

    The correct syntax would have been:
    mysqladmin -u root -pyourcurrentmysqlrootpassword password yournewmysqlrootpassword
    However, you should not spell out your root password on console. Instead, either make mysql prompt you for it or note it down into ~/.my.cnf or /etc/my.cnf and limit access to these files (chmod/chown).

  7. #7
    Thanks for all your help guys i reset the password and now mysql works fine.

Similar Threads

  1. DirectAdmin - Access denied for user 'apache'@'localhost' (using password: NO)
    By Peers in forum Hosting Security and Technology
    Replies: 2
    Last Post: 06-20-2009, 01:22 AM
  2. Access denied for user 'root'@'localhost
    By Greedisgood in forum Hosting Security and Technology
    Replies: 3
    Last Post: 06-08-2007, 09:46 AM
  3. Access denied for user 'root'@'localhost'
    By MarsNIIT in forum Hosting Security and Technology
    Replies: 12
    Last Post: 04-14-2006, 04:11 AM
  4. Replies: 17
    Last Post: 12-13-2004, 07:19 AM
  5. Replies: 2
    Last Post: 04-06-2003, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts