I recently had to change my website passwords after the site was hacked. It has been going along nicely without any changes for some years, and of course I have quite forgotten all the PHP I learned in order to create it and am feeling very foolish.
Those parts of the site which access the MySQL database use a connection script hidden in a private folder of the domain. It’s based on something I found in a PHP/MySQL programming book. Having changed the access password, then obviously I had to change what the script says. So I found my local copy of the site files, changed the password, uploaded the new script and… it doesn’t work and I have no clue why it doesn’t work. This is the script:
All I did, I swear, was replace the text of the old password within the single quotes with the new password, shown as ‘NewPassword’ above. The response I get from my browser when trying to retrieve anything from the database is is: “Could not connect to MySQL: Unknown MySQL server host ‘http’ (1)”. The new password is correct, I assure you: it works in phpMyAdmin, using the other details shown above.
Can anyone please give me a clue what might be wrong ? I suppose it’s remotely possible that the script I amended and uploaded was a faulty version, but if so I can’t work out how that might happen or what might be wrong with it. The error message seems to be suggesting that the URL to the database is somehow wrong, but phpMyAdmin doesn’t think so.