mystikzen

Member
Mar 18, 2004
13
0
151
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.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
42
348
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:
[email protected] [/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.