I have been running this same script for over a year and 5 days ago it stopped working. It connects to my MySQL server using my cpanel username and password. Now the script keeps failing.
I was on the phone the last 2 days for a total of 3.5 hours. A ticket was opened yesterday but it was closed today. Support says everything is woking OK. Thay said nothing has changed.
These are the statements in my script:
$link = mysqli_connect($dbhost,$dbuser,$dbpass) or die ('Error connecting to mysqli: ' . mysqli_error($link).'\r\n');
The error I get is: [06-Feb-2020 18:20:03 UTC] PHP Warning: mysqli_connect(): (28000/1045): Access denied for user 'MYCPANELUSERNAME@'localhost' (using password: YES) in /home/tif0qktaow5f/public_html/DB_Backups_Test/Includes/load_array_databases.php on line 14.
Any suggestions wil be greatly appreciated as I am using the script to do a daily backup of my databases.
Solved! Go to Solution.
Thanks for sending me the script - I tested it on my VPS/cPanel account and it worked - I uncommented the echo row and got the 2 Databases listed in my account.
Can you double check that you are running PHP 7.x and it didn't somehow revert to PHP 5.x - something still seems strange that it is the password issue.
From SSH can you get into mysql via
mysql -uCPANELUSER -pCPANELPASSWORD
If not try resetting your cPanel password and trying again
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
While this may sound obvious have you tried to reset the password / permissions or create a new user
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
On the cPanel account you should be able to go to "MySQL Databases"
From here you can add the user to the database (even if they are already added) and grant all permissions
You can also reset the password for the user as well as create a new user and assign that user to the database.
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
Going back to your original post the error was that it is giving you is that it is a password / user issue.
To the best of my knowledge with cPanel - it's not the cPanel username but rather the user name you created when you setup the database. Hence the reason I asked about the user / password.
Can you post any more of the code ??
Also I guess I'm confused unless you are dumping each table individually you could run a cron job to do the dump
Local Host mysql Backup:
0 1 * * * /usr/local/mysql/bin/mysqldump -uroot -ppassword --opt database > /path/to/directory/filename.sql
(There is no space between the -p and password or -u and username - replace root with a correct database username.)
It just seems like extra work to do this via a PHP script.
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
1) are there any errors that you can find other than what you posted?
2) If you try to run the script manually via the command line (outside of PHP) what do you get
3) Did anything change on the server last week ??
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
Thanks for sending me the script - I tested it on my VPS/cPanel account and it worked - I uncommented the echo row and got the 2 Databases listed in my account.
Can you double check that you are running PHP 7.x and it didn't somehow revert to PHP 5.x - something still seems strange that it is the password issue.
From SSH can you get into mysql via
mysql -uCPANELUSER -pCPANELPASSWORD
If not try resetting your cPanel password and trying again
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community