I get this error when I install wordpress using Web Platform Installer.
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at 127.0.0.1. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?
I can successfully install it in case IIS and wordpress folder are on the same machine.
But I get this error when I install wordpress on IIS and point that application to ther folder which is on some network but other virtual machine.
So, obviously IIS sees that folder (other non wordpress sites, ASP.NET are setup this way) but something else is problem. I tried putting different things inside wp-config.
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');
It is Windows Server 2016, and I had to change something in registry to succesfully install Wordpress, but I don't think that is problem because wordpress is now installed. But when I visit http://example.com/blogging/wp-admin/install.php I get error mentioned above.
Better add
define('WP_ALLOW_REPAIR', true);
in wp-config.php and try to repair your db connection.
Sometimes adding port number with localhost ip will fix the issues, please try this too
define('DB_HOST', '127.0.0.1:8889');
Related
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
Try Again
.
How to resolve this Error.. ?
I've tried Wordpress installation on both Xampp and Wamp servers...
getting the same error every time..on both servers.
The error message says everything you have to know. Wordpress can not contact MySQL. Look in your wp-config.php if the MySQL-crendentials are correct. Find more information at https://wordpress.org/support/article/how-to-install-wordpress/.
I am having a problem connecting to my WordPress site using Valet. I get the following error:
Warning: mysqli_real_connect(): (HY000/1045): Access denied for user
'db_username'#'localhost' (using password: YES) in
/Users/.../Documents/WordPress/.../wp-includes/wp-db.php
on line 1531
Error establishing a database connection
This either
means that the username and password information in your wp-config.php
file is incorrect or we can’t contact the database server at
localhost. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?
If you’re unsure what these terms mean you
should probably contact your host. If you still need help you can
always visit the WordPress Support Forums.
This is odd, as I am able to connect the page that is online to this database. This makes me believe that all of the following settings should be correct:
DB_NAME
DB_USER
DB_PASSWORD
DB_HOST
DB_CHARSET
DB_COLLATE
I also wanted to note that I do not have any redirection issues. I had this at first and solved it by changing the "DOMAIN_CURRENT_SITE" to my Valet domain.
Example:
define('DOMAIN_CURRENT_SITE', 'valetdomain.test');
I am also able to connect to the database within Sequel Pro on my computer with the same login information.
Note: I can use Valet on my other pages locally as well and that works fine.
So, I have Valet working, Sequel should be working, and the site works online. I just can't seem to get them all working together :(
Is it possible that the wp-config settings or some other settings must be different when connecting a WordPress site locally, via Valet in my case, as opposed to online?
Things I have tried:
Creating a new user within cPanel, adding them to this database, and updating wp-config accordingly
using no password and connecting via Root
using my server's IP address as the hostname instead of localhost
using 127.0.0.1 as the hostname instead of localhost
changing the siteurl and home within wp_options table to the .test domain that I'm using with Valet (this just kills my online site, but doesn't help me connect the DB for the local site in Valet)
One thing I'd like to note here is that if I use...
define('DB_USER', 'root');
define('DB_PASSWORD', '');
... then the error changes from the one above to simply "Error establishing a database connection." Is this somehow a "better" error, meaning that I could be closer to solving this problem?
Final note, I am using WP Multisite. Not sure if this makes any difference.
I was able to solve the problem by closing everything and restarting WordPress from scratch. I think the problem was that I had two versions of SQL running on my computer, one from Brew and the other from the Mac. This may have caused the problem. I'm not sure if this is the best advice, but it is what helped me.
I was using mysql 5.6.11,it usually turned down and show me this:
2005 - Unknown MySQL server host 'localhost'(11001).
Currently my resolution is to turn off the network,than it return to normal.I had searched a lot,but no answer is revalent to it.So,does anyone knows the reason?
ERROR 2005 (HY000): Unknown MySQL server host 'localhost' (0)
modify list of host names for your system:
C:\Windows\System32\drivers\etc\hosts
Make sure that you have the following entry:
127.0.0.1 localhost
In my case that entry was 0.0.0.0 localhost which caussed all problem
(you may need to change modify permission to modify this file)
This performs DNS resolution of host “localhost” to the IP address 127.0.0.1.
I have passed through that error today and did everything described above but didn't work for me. So I decided to view the core problem and logged onto the MySQL root folder in Windows 7 and did this solution:
Go to folder:
C:\AppServ\MySQL
Right click and Run as Administrator these files:
mysql_servicefix.bat
mysql_serviceinstall.bat
mysql_servicestart.bat
Then close the entire explorer window and reopen it or clear cache then login to phpMyAdmin again.
The case is like :
mysql connects will localhost when network is not up.
mysql cannot connect when network is up.
You can try the following steps to diagnose and resolve the issue (my guess is that some other service is blocking port on which mysql is hosted):
Disconnect the network.
Stop mysql service (if windows, try from services.msc window)
Connect to network.
Try to start the mysql and see if it starts correctly.
Check for system logs anyways to be sure that there is no error in starting mysql service.
If all goes well try connecting.
If fails, try to do a telnet localhost 3306 and see what output it shows.
Try changing the port on which mysql is hosted, default 3306, you can change to some other port which is ununsed.
This should ideally resolve the issue you are facing.
Follow these steps to fix this error
Use \connect root#127.0.0.1 instead of \connect root#localhost
if it doesn't work then go to C:\Windows\System32\drivers\etc\hosts and check the IP address attached to host name.
use that IP, so it will be.
\connect root#the_ip_address_you_found
Im trying to learn developing a simple website using Joomla 3.4.4. I Installed Xampp and joomla. I changed the ports in 'apache' and 'mySQL' from Xampp Control panel. (changing the port httpd.conf file to 8080, port in httpd-ssl.conf file to 4433 and respective one in mySQL to 33066). I can access localhost:8080 and view the home page. But when installing the the joomla on xampp server (after extracting the joomla files to htdocs folder) the first installation page is perfectly loaded and information is asked about the site. When the But in 'database configuration' phase's progress bar never ends. I can't go beyond that. Information provided in database configuration phase is as follow:
database type: MySQL
Host Name : localhost:8080
User Name : root
password : password
Database Name : joomla17
Table Prefix : jj_
There's another problem that was arisen with this installation. Even though I can access localhost:8080 page, I can access phpMyAdmin. It says these errors:
MySQL said: Documentation
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
Please Help me with these issues.
I have hosted a WordPress site, http://edufunweb.azurewebsites.net/, on Azure. It was working fine until I wanted to host another site. So I went to the edufun wp-config.php file in Microsoft Webmatrix and changed the line
$table_prefix = 'wp_';
to
$table_prefix = 'wp_2';
(or maybe it was the other way around) in order to have different tables in the database for each of the sites. Then I deleted the other site and now with whichever codes above I get a
Warning: mysql_connect(): Access denied for user 'abcd'#'xxx.yyy.zzz.xx' (using password: YES) in D:\home\site\wwwroot\wp-includes\wp-db.php on line 1461
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at eu-cdbr-azure-north-c.cloudapp.net. This could mean your host's database server is down.
Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?
If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
Moreover, if I connect to http://edufunweb.azurewebsites.net/wp-admin/
I still get the same error.
Your help is highly appreciated as I need my website back on track!
I don't think this is a WP multi-site issue. This typically is caused when the connection string to the host mysql server is not correct.
Here's an easy way to test this.
Open wp-config.php and locate the following lines.
/** MySQL database username */
define('DB_USER', 'user_name');
/** MySQL database password */
define('DB_PASSWORD', 'user_password');
/** MySQL hostname */
define('DB_HOST', 'some_hostname');
Next, open your WP site in the Azure Management Portal. Go to the Configure tab and scroll down to Connection Strings. Click "Show Connection Strings". Copy it into a text editor and compare the values to what you see in wp-config.php. If those values are not the same then keep both copies and do the next step.
Next, open your local shell and open mysqladmin by typing in the following, replacing the values from above here below (without single quotes), note there is no space between the -p parameter and the password value itself.
mysqladmin -u user_name -puser_password -h some_hostname
One of those connection values should be correct and if so replace the one that is not correct with the one that is. If neither work, then go back to the Azure Management Portal to your site, click on Linked Resources, click the item that appears and you should be in the Clear DB management portal where you can get the correct connection information for your MySQL Database.
After you have sorted you can go configure your WP Multi-site. Here is an article on how to do that for Azure Web Apps, http://azure.microsoft.com/en-us/documentation/articles/web-sites-php-convert-wordpress-multisite/
hope that helps.
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', '');
define('PATH_CURRENT_SITE', '');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
those lines add to config.php and check wp-admin, there is an option network admin. Go to the network admin and after that go to the settings and setup network from Network Setup option.
Go to the Site option and Add New Site.