---
title: "Creating a database"
date: "2015-01-30"
category: "mysql"
slug: "creating-database"
---

This article covers creating MySQL databases, connecting to them, and managing user permissions through the control panel.

## Creating a Database

1. Open the [[logging-into-the-control-panel]] and navigate to **Databases** > **MySQL Manager**
2. Enter the new database name under **Name**
    - Optionally deselect _Backup database_ if you want no backups. Without backups, a corrupted database cannot be restored.
3. Optionally click **Advanced** to configure backup frequency, retention count, and an import file. For larger databases, consider keeping 2 copies with daily backups for 48 hours of protection. Import files may be plain-text or compressed.

    [![Importing a database](kb-image:db-sql-import.png)](kb-image:db-sql-import.png)Importing a database

4. Click **Create**
5. The database name will consist of your _database prefix_ plus the _name_ you entered.
    - In the example below, the database is named `dc_test`

        ![Database prefix illustration in MySQL Manager](kb-image:db-prefix-illustration.png)
*Database prefix illustration in MySQL Manager*

## Connecting to Your Database

Use a hostname of `localhost`, your username, and your database password. If you forget your password, you will need to [[resetting-mysql-password]].

**Note:** Always use `localhost` for local connections, unless you are [[connecting-remotely-mysql]] or using Java database connection pooling (DBCP). For DBCP, use `127.0.0.1` to connect over a TCP socket.

## Granting Access to Other Users

By default, only the primary user has access to a newly created database. To grant access to additional users:

1. Navigate to **Databases** > **MySQL Manager** > **List Users and Databases**
2. Select the database
3. Enable **READ** or **WRITE** privileges for the desired user
    - For normal operation, select both READ and WRITE
    - Click **Advanced** for granular permission control (use with caution)
4. Click **Save**

## See Also

- [Privileges provided by MySQL](http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html)
