The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to back up MySQL database?

Discussion in 'General Discussion' started by calvinphanctt, Mar 17, 2011.

  1. calvinphanctt

    calvinphanctt Active Member

    Joined:
    Mar 27, 2007
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Hello everyone,

    I need to back up my database using this command:

    mysqldump --opt -Q -u database_user -p database_name > mydatabase.sql

    but it asked for the password, I enter the password for that database_user but it said :
    mysqldump: Got error: 1045: Access denied for user 'timbanga_timbang'@'localhost' (using password: YES) when trying to connect.

    What should I do? I enter password correctly though.

    Sincerely,
    Calvin
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Calvin,

    You would need to either use the root user without passing the -p flag or the cPanel username user rather than the cPanel database username, so timbanga user's password for cPanel and MySQL instead:

    Code:
    mysqldump --opt -Q -u timbanga -p database_name > mydatabase.sql
     
  3. calvinphanctt

    calvinphanctt Active Member

    Joined:
    Mar 27, 2007
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Hi Tristan,

    It doesn't work either. The same error message!

    Please help! Thank you.

    Regards,
    Calvin
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Did you try as the root user? Are you certain that is the MySQL username and password for that user? If it is the right MySQL password for the user, then this command will work:

    Code:
    mysql -u timbanga -p
    When prompted for the password for the timbanga user, then enter it. If it lets you into MySQL, then the password is right. If it doesn't let you into MySQL, then that isn't the user's MySQL password.
     
  5. calvinphanctt

    calvinphanctt Active Member

    Joined:
    Mar 27, 2007
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I even tried the password for user "root" but it still didn't work. I have the config file with the password I set, I guarantee it is correct but I don't know why it keeps giving that error message!



    Please help.

    Thank you.

    Regards,
    Calvin
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    If it was me I think I'd just go to my cPanel, click this users name in Databases section and give him a new password and then try that password with my backup command. To troubleshoot, basically. If it works be sure to update that config file with the new password.

    GL!
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Can you even enter MySQL command line on the machine in question?

    Code:
    mysql
    Please enter that in root SSH when logged in as the root user. If you receive an error, please indicate it here.

    If you can log into that service, then open up a ticket. The root user when *not* passing the -p flag using mysqldump should always work if you are logged in as root. As such, if you tried as root user and did not pass the -p flag, it shouldn't have rejected the command. There's something wrong with MySQL if it did.
     
Loading...

Share This Page