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.

mysql.user table lost

Discussion in 'Database Discussions' started by mystikzen, Dec 19, 2011.

  1. mystikzen

    mystikzen Member

    Joined:
    Mar 18, 2004
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    after a system crashed, I have lost all mysql users.
    I managed to recover a few of them but not the ones used to access phpmyadmin under cPanel.
    How can I recover them ?

    Thank you.
     
  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
    Do you have any cPanel backups available? If you do not, you might check /var/cpanel/databases to see if a list of grants is available there for each user to recreate the users in MySQL command line. The files for grants will look similar to the following:

    Code:
    root@host [/var/cpanel/databases]# cat grants_cptest.yaml
    --- 
    MYSQL: 
      cptest: 
        cptest: 
          - GRANT USAGE ON *.* TO 'cptest'@'208.74.124.109' IDENTIFIED BY PASSWORD '*D9D9A5D88C42480E4B782E9DD9799FB81DEBB4DF'
          - GRANT USAGE ON *.* TO 'cptest'@'host.daniellewallace.com' IDENTIFIED BY PASSWORD '*D9D9A5D88C42480E4B782E9DD9799FB81DEBB4DF'
          - GRANT USAGE ON *.* TO 'cptest'@'localhost' IDENTIFIED BY PASSWORD '*D9D9A5D88C42480E4B782E9DD9799FB81DEBB4DF'
    PGSQL: 
      cptest: {}
    If you do not have /var/cpanel/databases/ with the grants listed nor have any backup files, you are going to have to recreate each database user from scratch. I would highly suggest contacting your datacenter, NOC or provider at that point.
     
Loading...

Share This Page