Opened 4 years ago
Last modified 4 years ago
#52648 new defect (bug)
Problem with certain passwords not working to login to mysql db
Reported by: | kellnerp | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | 5.2 |
Component: | Database | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
After migrating my WordPress blog from 1and1 hosting to a FAMP server the blog would not come up and complained it couldn't connect to the database. When the database was migrated the same username and password were retained from the 1and1 site. I traced the problem to wp-db.php in wp-includes on the following line:
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
By hardcoding this password into this line:
@mysqli_rea$this->dbpasswordl_connect( $this->dbh, $host, $this->dbuser, "SpivknocKs3%", null, $port, $socket, $client_flags );
The WordPress blog would come up. (Note this is no longer the password for the database.)
I also echoed $this->dbpassword and it was the same as the hard coded password but only the hardcoded version of the password would allow a connection to the database.
I changed the password for the database to one containing only upper and lowercase characters and numbers and it would connect fine and the blog would work. The problem was not quite this easy however. It also depended on whether I was logging in as "user"@"localhost" or "user"@"127.0.0.1". Both users existed on the mysql database and both had the same GRANTS.
I tested the mysqli_real_connect() call independent of WordPress using the CONSTANT declarations from wp-conf.php pasted into the php manual reference code for this call and got similar results.
I had moved the blog to a server running FreeBSD 12, apache 2.4, php 7.4, and mysql 5.7 when this problem started. I am currently running WordPress 5.2.9 running Arclite theme.
Change History (2)
#2
@
4 years ago
Updating WordPress was in my bucket list and is now completed. Updating to 5.6.2 made no change to this problem as it appears to be something underlying in the php - mysql connection.
I did a little more testing.
In the old password I showed above the problem seems to be the 3% at the end.
I created a new user and password ending in 3%. WordPress would not connect. Removing the 3% at the end of the password and flushing privileges allowed WordPress to connect to the database.
This still doesn't explain why the password had to be hard coded into wp-db.php to make it work.
Hi there, welcome to WordPress Trac! Thanks for the report.
Just noting that WordPress 5.2.x does not support PHP 7.4, see PHP Compatibility and WordPress Versions.
WordPress 5.3.x is the earliest version to support PHP 7.4, see WordPress and PHP 7.4.
Does the problem still happen if you update to the latest stable WordPress version, 5.6.2 at the moment?