Havenswift Hosting Ltd
All guides

Creating a database and a database user

An application needs two things: a database to store data in, and a user with permission to use it. Creating one without the other is the most common mistake.

The steps

In cPanel, open MySQL Databases.

  1. Create the database. Type a short name. Your account name and an underscore are added automatically, so typing "shop" produces something like account_shop. The full name is what your application needs.
  2. Create a user. Same prefixing applies. Use the password generator rather than inventing one – nothing has to remember it except a configuration file.
  3. Add the user to the database and grant ALL PRIVILEGES. This step is the one people miss, and without it the application connects and then fails on the first query.

What your application needs

The name length limit

Database and user names are limited in length, and your account prefix counts toward it. If a long name is rejected, that is why – shorten the part you chose.

One database per application

Do not share one database between two applications unless the software specifically supports it. Separate databases mean you can back up, restore or delete one without touching the other.

Other guides

Still stuck? Sign in and raise a ticket, and somebody will answer it.

Sign in