Shared hosting

How to add a database

2017-10-07

Below is how to create a MySQL database and a user for it, and what to check if the site cannot connect to the database.

How to create a database

  1. Open "Main" -> "Databases".
  2. Click "Create DB".
  3. Enter the "Database name" and "Encoding" (we recommend utf8mb4).
  4. Keep "Create a user with the same name" checked to get a database user right away.
  5. Click "Create". The user's password is shown only once, so save it.

How to add a database

To connect from your site's scripts, use the host localhost, the database name, the user name and the user's password.

How to add another database user

  1. Open "Main" -> "Databases" and click the database in the list.
  2. Go to the "Users" section.
  3. Click "Create user" and choose the databases the user can access and the privileges.

How to add a database

You can also change the user's password there ("Change password"). Privileges and database access are changed in the user's settings ("Access and privileges").

If you need to connect to the database remotely, set up the user's "Remote access" (see the article "How to connect to the MySQL server remotely?").

If the database does not connect

  • Check the database name, user and password in the site config. If unsure, set a new password for the user.
  • The MySQL host for sites on the hosting is localhost.
  • If importing a large dump fails with Got a packet bigger than max_allowed_packet, contact support.

Exporting and importing a database is described in the article "How to export/import a MySQL database?".