MySQL

From LAMP Host Knowledge Base
Revision as of 11:58, 24 July 2013 by Lamphost (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Every new site installed at LAMP Host comes with its own MySQL Database. A database is most commonly used to store the dynamic, or modifiable, content for your site. This includes text content such as blog pages in WordPress, nodes in Drupal, and commonly modified CMS settings.

Using your initial MySQL Database

When you complete your order for a hosting plan, you will receive an email notification titled Welcome to LAMP Host! yourSite.com is now active! Be sure to read and save this email, as it contains the login information for your MySQL Database.

MySQL Login Example
MySQL Hostname: localhost
MySQL Database: examplesitedotcom
MySQL Username: 0987
MySQL Password: ANg3Um5Uphu1

When installing your web application (WordPress, Drupal, Joomla, etc.), this is the information you will use to plug into the appropriate locations in the app's configuration file. The format by which this information is entered can vary depending on the application being installed. See below for examples of how this data could be requested.

WordPress 3.5.x, wp-config.php
/** The name of the database for WordPress */
define('DB_NAME', 'examplesitedotcom');
/** MySQL database username */
define('DB_USER', '0987');
/** MySQL database password */
define('DB_PASSWORD', 'ANg3Um5Uphu1');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Drupal 7, sites/default/settings.php
$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'examplesitedotcom',
      'username' => '0987',
      'password' => 'ANg3Um5Uphu1',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
Drupal 6, sites/default/settings.php
$db_url = 'mysqli://0987:ANg3Um5Uphu1@localhost/examplesitedotcom';

Browse and Manage your Databases

MySQL Admin in the Site Manager

The Site Manager provides the MySQL Admin tool for management of your MySQL databases. The features of this tool are detailed below.

Databases

The Databases page displays all existing MySQL databases installed for your site. If your hosting plan supports multiple MySQL databases, you can use this tool to add new databases by clicking the Add MySQL Database tab.

New databases must keep the common naming scheme yourwebsitedotextention_newdatabase.

Database Users

The Database Users page displays all MySQL users with privileges to access your databases. By default, at least one user will automatically set up to access your initial MySQL database.

If you have forgotten or lost the login information for your initial database, visit the Database Users page to view existing users. Save the username in the 'User' field for your records, then click Change Password to set a new password. Be sure to save this login information to set up your database-enabled web applications.

If you have added new databases to your site, use the Add MySQL User tab to add a new user for the database. After adding the user, click Privilege Details to assign privileges to your new database. While individual privileges can be set, it is generally safe and recommended to check the Select All box.

phpMyAdmin

A full installation of phpMyAdmin is included in the Site Manager tools. phpMyAdmin allows you to browse the data within a MySQL database and manipulate it manually. This can be useful for deleting or modifying data in the database when no front-end interface to do so is provided with your CMS. Manual database access can also be used to rescue a broken site after applying a bad setting in your CMS front-end.

To log into phpMyAdmin, click the phpMyAdmin link under the main MySQL Admin tool. You will be queried for a username and password. The MySQL Username and MySQL Password from your Welcome to LAMP Host email should be entered here. If you have modified the MySQL User's password or added a new user, you should use your new username and password instead.

phpMyAdmin Login phpMyAdmin Interface