Skip to main content

Update MySQL Settings on Your web.stanford.edu Site

This guide will show you how to update MySQL settings for your WordPress, Drupal, or Mediawiki site to access your new cloud-hosted database.

Before you begin

Always back up your database before making any changes. This will allow you to restore your database if something goes wrong.

For WordPress sites:

In WordPress, the MySQL settings are stored in the wp-config.php file, which is located in the root directory of your WordPress installation. The following variables should be updated to reflect new values. Please substitute real values for the italicized values below. 

/** The name of the database for WordPress */
define('DB_NAME', ‘new-database-name');

/** MySQL database username */
define('DB_USER', 'new-database-user’);

/** MySQL database password */
define('DB_PASSWORD', ‘new-database-password‘);

/** MySQL hostname – if currently set to 127.0.0.1 */
define('DB_HOST', '127.0.0.1:3308');

/** MySQL hostname – if currently set to mysql-user.stanford.edu */
define('DB_HOST', ‘mysqlhosting.cl.stanford.edu’);

​For further information about wp-config.php, please see https://developer.wordpress.org/advanced-administration/wordpress/wp-config/

For Drupal sites:

In Drupal, the MySQL settings are stored in the settings.php file, which is located in the root directory of your Drupal installation. The following variables should be updated to reflect new values. Please substitute real values for the italicized values below.

/** If currently set to 127.0.0.1 */
$db_url = 'mysqli://new-db-user:new-db-password@127.0.0.1:3308/new-db-name';

/** If currently set to mysql-user.stanford.edu */
$db_url = 'mysqli://new-db-user:new-db-password@mysqlhosting.cl.stanford.edu/new-db-name';

For further information on updating your Drupal configuration, please see https://www.drupal.org/docs/8/configuration/database-configuration 

For MediaWiki sites:

In MediaWiki, the MySQL settings are stored in the LocalSettings.php file, which is located in the root directory of your MediaWiki installation. The following variables should be updated to reflect new values. Please substitute real values for the italicized values below.

$wgDBtype                       = "mysql";
$wgDBname                    = "new-db-name";
$wgDBuser                       = "new-db-user";
$wgDBpassword            = "new-db-password";
/** If currently set to 127.0.0.1 */
$wgDBserver                   = "127.0.0.1:3308";
/** If currently set to mysql-user.stanford.edu */
$wgDBserver                  = " mysqlhosting.cl.stanford.edu "; 

For further information on updating your MediaWiki configuration, please see https://www.mediawiki.org/wiki/Manual:LocalSettings.php

Last modified