Cannot Read DB Password
Error: Cannot Read DB Password while Ezeelogin version upgrade
The error below occurred during the Ezeelogin upgrade process because the Ezeelogin database user’s password cannot be read from the Ezeelogin configuration file (/usr/local/etc/ezlogin/ez.conf).
This issue can only be resolved if you have a backup of ez.conf or the latest Ezeelogin full backup.
Below is an example of the default Ezeelogin configuration file. The ez.conf file should include a db_pass parameter to retrieve details from the database.
Steps to resolve the issue:
1. Run below command to retrieve the database user's password. Enter super admin password (user created at the time of installation) when prompted.
root@gateway:~# php /usr/local/ezlogin/eztool.php -show_db_credentials
Enter the Ezeelogin administrator password:
Example:
Unable to connect to database (1045): Access denied for user 'ezlogin_tgqd'@'localhost' (using password: YES)
DB settings:
Host:
User: ezlogin_tgqd
Pass: bb{F*]Y@@%vS7Y&Ukr!p/h(qS
DB: ezlogin_ubnul
Port:
Socket: /var/run/mysqld/mysqld.sock
2. Reset the Ezeelogin database user’s password back to the original password. Replace the username and original database user's password
root@gateway:~# mysql -u root -p
mysql> ALTER USER 'username'@'localhost' IDENTIFIED BY 'original_password';
mysql> FLUSH PRIVILEGES;
mysql> exit
Example:
mysql> ALTER USER 'ezlogin_tgqd'@'localhost' IDENTIFIED BY 'bb{F*]Y@@%vS7Y&Ukr!p/h(qS';
mysql> FLUSH PRIVILEGES;
3. Create a directory and extract the latest backup file to recover the password. If you have a backup of ez.conf, replace it with the original configuration file. Backup the current ez.conf file and replace it with the backed-up ez.conf. Ensure to backup the current ez.conf
root@gateway:~# mkdir ./backup_extract
root@gateway:~# sh /var/ezlogin_backup_****.bin --noexec --target ./backup_extract/
root@gateway:~# cp /usr/local/etc/ezlogin/ez.conf /usr/local/etc/ezlogin/ez.conf.backup
root@gateway:~# cp ./backup_extract/etc/ez.conf /usr/local/etc/ezlogin/ez.conf
or
root@gateway:~# cp /usr/local/etc/ezlogin/ez.conf /usr/local/etc/ezlogin/ez.conf.backup
root@gateway:~# cp ./ez.conf_old_backup /usr/local/etc/ezlogin/ez.conf
4. Download Ezeelogin package according to the PHP version you are running and run upgrade script.
For PHP version 8.2 and above: | https://downloads.ezeelogin.com/ezlogin_7.37.2_php82.bin |
For PHP version 8.1.x: | https://downloads.ezeelogin.com/ezlogin_7.37.2_php81.bin |
For PHP version 7.x (end of life): | https://downloads.ezeelogin.com/ezlogin_7.36.0_php71.bin |
root@gateway:~# wget https://downloads.ezeelogin.com/ezlogin_7.xx.xx_phpxx.bin
Run the command below, replacing binary package with the correct name to upgrade to either the same version or the latest version.
root@gateway:~# sh ezlogin_7.xx.xx_phpxx.bin -- -update -skipbackup
If you encounter below mentioned error during the upgrade, you need to grant access to the database user.
To retrieve the database credentials run the below command and enter the super admin password (user created at the time of installation).
root@gateway:~# php /usr/local/ezlogin/eztool.php -show_db_credentials
Example:
User: ezlogin_tgqd
Pass: bb{F*]Y@@%vS7Y&Ukr!p/h(qS
Execute the following commands to grant access to the database user.
mysql> ALTER USER 'db_username'@'localhost' IDENTIFIED BY 'db_user_password';
Example
mysql> ALTER USER 'ezlogin_tgqd'@'localhost' IDENTIFIED BY 'bb{F*]Y@@%vS7Y&Ukr!p/h(qS';
After the successful grant run the upgrade command again.
5. After successful upgrading, login to the Ezeelogin GUI, add some test servers and users, and also login to ezsh and SSH to some random servers to confirm that everything is working fine.
Related Articles