How do I create an empty MySQL Database

To create the database, do the following:

  1. Log into the cpanel
  2. Click the MySQL Databases icon under the "Databases" category
  3. Create a New Database (make it short best result)
  4. Add New User (make it short best result)
  5. Most importantly, select the user and database underneath "Add User To Database" and click "Add" (authentication will not work if you do not click this button).

After doing all these steps, you can create the database tables either via phpMyAdmin or use an online PHP or Perl script.

The username format will be: username_dbusername
The database format will be: username_dbname
The hostaddress will be: localhost

For example, if you enter the following variables:

    dbusername: admin
    dbname: DB1
    password: password

You will end up with the following format that you would place in your connection string

    Hostname: localhost
    dataName: username_db01
    dataUser: username_admin
    Password: password

Notice the password remains the same format.

The connection string can be either of any examples below:

For example, we will use the above example variables:

    Connection Strings
    For PERL
    $dbh = DBI->connect("DBI:mysql:username_db01:localhost","username_admin","password");

For PHP:

    $dbh=mysql_connect ("localhost", "username_admin", "password") or die ('I cannot connect to the database.');
    mysql_select_db ("username_db01");

To create tables and other functions, you can use the PHPMyAdmin located in the Databases section of the cPanel. For more information on how to work with PHPMyAdmin. please visit:


  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What version of MySQL are you running?

The current version can be viewed in the cPanel on left side.

I can't connect to my database locally or remotely, do I have the correct server, username and password?

Since we run a shared hosting environment, we have to uniquely identify your MySQL Users to your...

How do I create a MySQL backup?

There are three options available to backup your MySQL databases: 1) Use the backup utility in...

I need to Export or Import a MySQL database

Note: PhpMyAdmin can only import and export databases up to 50 MB in size. If your database is...