I do not know what else to do, I would suspect about Wordpress, but it was working fine just before changing the domain, and I only changed the domain for the new one, I left the same: administrator username, the home directory, and the user name suffix and group all are the same as in the old domain.
You appear to have done everything right WRT configuration of WordPress. Try changing the database password of the virtual server via Virtualmin. Then apply the new password to the appropriate config files in WordPress.
Hopefully this shot in the dark will fix the issue.
I’ve never seen that in a WP Config file and I’ve done well over a hundred Wordpress sites. Mine always have the setting for the database host and that’s always localhost.
WP Config doesn’t care about the domain name that I’ve ever seen.
Just for giggles, comment out that line completely and see what happens.
In wp-config.php I commented the line:
/** define(‘DOMAIN_CURRENT_SITE’, ‘newdomain.com’); **/
And when ran …://newdomain.com/index.php it sent me to the old domain with the corresponding error not finding it. We can’t connect to the server at olddomain.com
I created a new DB user and new random generated password, via Edit Databases in the Virtualmin account, while doing this I ran again: …://newdomain.com/index.php and got this obvious error, because I had not changed yet the user in wp-config.php
Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘originaluser’@‘localhost’ (using password: YES) in /home/account/public_html/wp-includes/wp-db.php on line 1653
Access denied for user 'originaluser'@'localhost' (using password: YES)
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.
I changed the user and password for the new one created and I got, the same original one line error, with no more details: # Error establishing a database connection
I do not know what else to do, the problem is that this is was working before the change of domain name on the Virtualmin account.
Any more ideas are welcomed, thanks in advance.
Please note that all users and passwords I have tried are first tested with the above mentioned script, and all of them connect successfully to the wp database, and I was able to connect and make URL change to the wp database in table: wp_options using adminer
This is the content of the wp-config.php file I appreciate if someone can find an error:
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'account_wordpress');
/** MySQL database username */
define('DB_USER', 'dbuser');
/** MySQL database password */
define('DB_PASSWORD', 'userpass');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
define('WPLANG', 'es_ES');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', 'qGtX3O11P8aSUvclem2QSGKdNYsDysobwt5fhlXZlvlpeuROSdV5GUbmufhHIpUV');
define('SECURE_AUTH_KEY', '3J6Tld8G1zlhADbLuagubGp7iWZVgv71ZYOk50HXRWZqnOmj55mJFCTrrwRGTMim');
define('LOGGED_IN_KEY', 'VXNwtnfighP2K0ZzE5LH6RAO2hIW78L0INr1Qy0DIuCSmZYzqkjPxwD84FfVbKvd');
define('NONCE_KEY', 'Sp7x5cyoLv4uVlxnX99fDXK04lWYFY6R1zFQhXCdTHvCFAN6zl8m2UR6AlXFtDB9');
define('AUTH_SALT', 'YrphircWuUErrAxiPQcoUlASrWCfJNNL2ApgQXPlGcl4VXu7ct6f2gJlMsUqSVcf');
define('SECURE_AUTH_SALT', 'YyoLvCc0t2BSmYOWP8ann9LkLWAcGCzQXRRE8dSZvlh1pm9Iw4nY8soAfKgnCwcD');
define('LOGGED_IN_SALT', 'kzTQoptGhXeSCrNHKBpa6CQyZW5XW3x0qo0EvLLr1WcGTst71PcuKdyUQFw6ebNt');
define('NONCE_SALT', '74VCe5lkNfYVA5g64WdqpEoKxhvbI0KWlGeK2CdJylo7I07qynphjRgEmwVmSpB6');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', true );
define( 'FS_METHOD', 'direct' );
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'newdomain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('ALLOW_UNFILTERED_UPLOADS', true);
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
I have no idea what all of that is or what it’s doing in your wp-config file. Again, over 100 Wordpress sites I’ve done over the years, I’ve never seen anything like that in a wp-config file.
Hello and thanks to all.
It is a multisite website, and it was working fine before the change of the domain using Virtualmin, using all those parameters in the wp-config file.
Any more ideas?
Thanks and regards.
After the rename, check /etc/httpd/conf/httpd.conf to see if there are any ‘old’ entries of the domain and that new domain is what it says it is. For the individual domain -->services -->configure website → edit directives, may show correct entries after the rename but I would check the main apache config to see if something or some entries capturing old domain still.
Were you using Virtualmin all along? If not, you need to explain what you really did. If you were on a different server and then just created a new server with Virtualmin then that’s going to cause a boatload of problems with multisite.
I think what he is trying to say is that it was working fine before the name change (same host/server). Wordpress, database, credentials etc fine as expected. When he renamed the domain to domain2, settings got out of sync and there is obviously some entries pointing to old domain name still.
That’s what doesn’t make sense. In multisite, that’s not going to change the location of the database or anything else so it shouldn’t do that.
But a lot of what he’s saying makes it seem like he was hosting somewhere else, then set up a Virtualmin install, then that’s when everything went south.
Otherwise, why was he even messing with Bind, Apache and MariaDB to begin with? That would have all been running from the outset.
Sorry if I did not explain my self correct, English is not my native language. It is like you said @Whoops.
1. Originally I had: Virtualmin Original User (vminoriginaluser) working fine, with that wp-config.php file and database vminoriginaluser_wordpress with vminoriginaluser granted all tables to this database and its password.
1.1 I had ServerA with
1.2 VPS account: home/vminoriginaluser/
1.3 Domain: olddomain.com
1.4 WP Directory: home/vminoriginaluser/public_html/wp-content/ and the other wp directories
1.5 WP Database: vminoriginaluser_wordpress and vminoriginaluser and password
1.6 WP config file: home/vminoriginaluser/public_html/wp-config.php
1.7 WP installed: 5.7
Then I made the change of olddomain.com for newdomain.com, only, I changed nothing else on the virtualmin account, I did it with vminoriginaluser in this menu:
Virtualmin > olddomain.com > Server Configuration > Change Domain Name >
New Domain Name: newdomain.com
*Change Administration User Name: Leave as vminoriginaluser <selected
*Change Home Directory: Leave as home/vminoriginaluser <selected
*Change user name suffix and group: Leave as vminoriginaluser <selected
So I have now:
2.1 I have same ServerA with
2.2 Same VPS account: home/vminoriginaluser/
2.3 But New Domain: newdomain.com
2.4 Same WP Directory: home/vminoriginaluser/public_html/wp-content/ and the other wp directories
2.5 Same WP Database: vminoriginaluser_wordpress and same vminoriginaluser same password
2.6 Same WP config file: home/vminoriginaluser/public_html/wp-config.php
2.7 Same WP installed: 5.7
This is the contents of VirtualHost vminoriginaluser taken from apache httpd.conf file, I am not an expert in apache, I can not see how can this affect to WP database connection, please let me know if something is bad in these apache directives.
Thank you to all of you for your valuable time devoted to my problem, I appreciated, regards
Hello @cyberndt the administration user of the account is also the user of the database and it always had Database = ALL and I double-checked and it is correct. In fact, using Adminer with that user, I was able to change in table wp_options the registers: siteurl and home. The user can do anything with the database.
Hello @Gomez_Adams the error is very brief: Error establishing a database connection no more information, this is the capture:
They’re going to ask the same thing. Caching is a huge issue and many people think they’ve cleared it when they haven’t. That’s why people ask for a link, to see if they get the same errors and if not which errors do they get.
It’s different about half the time, believe it or not.
Thank you for your kind help @Gomez_Adams I read in other web pages about the Cache issue in Wordpress and other CMSs, I disabled the cache via the config file. I have several Virtual Machines I checked with different Linux OS and browsers and a relative checked the website via her phone in another country and she got the same DB connection error.
Thanks and regards.