riverkash
Member
Posted 7 months ago #
First of all, I have phpmyadmin installed and working fine.
My problem...
I have just installed the latest version of WP and when I go to http://localhost/wp/wp-admin/install.php I get the Error Establishing a database connection screen. The connection details within my wp-config.php file are correct and match phpmyadmin.
Does anyone have any ideas?
You might need to check your database credentials with your hosting provider
riverkash
Member
Posted 7 months ago #
Just to add to this, I can also connect to MySQL from the CLI (Command Line Interface) using Terminal.
Do you get "Error Connecting to Database"? If so, open wp-includes/wp-db.php and after the line
if(!$this->dbh) {
add this:
echo(mysql_error());
That will display your true error
Do not edit core files. Check your server error logs instead.
On localhost you have define('DB_HOST', 'localhost'); in your wp-config, and no port number?
True, you shouldn't edit core files, but if you don't have access to said server error logs, my code would help. Maybe I should have put a disclaimer stating that editing core code is not recommended and should be reverted ASAP
Maybe I should have put a disclaimer
Yes - you should.
riverkash
Member
Posted 7 months ago #
Thanks everyone for your support, I have rectified the problem.
Due to the nature of of my "/etc/hosts" file, the localhost was not working in the wp-config.php.
In the wp-config.php I replaced localhost with "define('DB_HOST', '127.0.0.1');" and now have a database connection.
Once again thanks to all that helped with this.