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 server1.example.com -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
    Location
    Charlotte, NC
    Posts
    42
    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
    Location
    NYC / Memphis, TN
    Posts
    1,454
    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?
    PeakVPN.Com | Complete Privacy VPN | Cloud Hosting | Guaranteed Security | 1Gbps-10Gbps Unmetered
    PeakVPN | 31 VPN Servers | 17-Years Experience | Emergency 24/7 Support
    Visit us @ PeakVPN.Com (Coming SOON) | ASN: 3915

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

    Enter password:


    Try this .Hopefully it should work

  6. #6
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    37
    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. ERROR 1045: Access denied for user: 'root@localhost'
    By andy18 in forum Hosting Security and Technology
    Replies: 17
    Last Post: 12-13-2004, 07:19 AM
  5. ERROR 1045: Access denied for user: 'root@localhost
    By titoboo in forum Hosting Security and Technology
    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
  •