MySQL databases: creating, phpMyAdmin user, importing, remote connections and errors

Most database questions are not about the database itself but about connecting to it from outside the server: a desktop program, a cloud application, an external service, an ODBC connection. This article covers that first, because it is what people ask most.

Create the database and its user (this is your phpMyAdmin user)

In the new cPanel

The phpMyAdmin user is your database user. In the new design they are created together:

  1. Open Databases in the left menu and click Create database.
  2. The wizard has three steps: database name, user (with its password) and privileges. Note that both the database and the user carry your account prefix.

Wizard to create a database

To open phpMyAdmin, click Manage on the database in that same section. If you will connect from outside the server, see Databases: remote connections. Screenshots show the panel in Spanish.

If your cPanel has the classic design

If your panel shows icons grouped in sections, you are on the classic design: follow these steps, or switch to the new design from the button at the top of the panel.

El usuario para ingresar a PHPMyAdmin debe crearlo dentro del menú Bases de DatosL de su panel de control. Simplemente ingrese al menú Bases de Datos, y registre un nuevo usuario con perfil DBA (Database Administrator). Utilice estos datos para ingresar al panel de control PHPMyAdmin.

Connecting from outside: the two layers

By default your database only accepts connections from the server itself. That is correct: a database open to the internet is a compromised database. To connect from outside, your IP must be allowed in two layers:

  1. MySQL's allowed hosts list, which you manage in cPanel under Remote MySQL.
  2. The server firewall, which we always have to open on our side. Port 3306 is not open in general, only per address. So even if you add the IP in Remote MySQL, write to us so we also allow it in the firewall.

After adding the IP, wait 5 to 10 minutes before deciding it failed.

Connection details

ServerYour server's name, or its IP
Port3306
DatabaseThe full name, with your account prefix
UserThe database user, also with prefix
PasswordThe database user's password

Port 3306 is the one enabled for external connections; if you saw 13306 somewhere, that is internal and does not work from outside.

If your application is in the cloud

The IP to allow is not yours but the service's public outbound IP. In Azure App Service it is under Properties → “Outbound IP addresses”; other providers name it similarly. There are usually several, and all must be allowed. If you changed the port or IP and it still fails, restart your app: it may be using a cached connection.

If your IP changes, repeat it

Home or standard fiber connections usually do not have a fixed IP. When your provider changes it, the authorization stops applying and the connection fails again.

“Connection refused” — check in order

  1. Did you allow the right IP (from the connecting machine, or the cloud service's outbound IP)?
  2. Are you using port 3306?
  3. Did you ask us to open the firewall for your IP, and did we confirm it?
  4. Have 5–10 minutes passed since we confirmed?
  5. Do the user and database include your account prefix?
  6. Is that user assigned to that database with privileges?

Import and export

Exporting from phpMyAdmin works well for small and medium databases. phpMyAdmin's upload limit is 100 MB; if your file is larger, write to us and we will import it another way. Before importing over an existing database, be sure you want to replace it: there is no undo.

Other common errors

“Error establishing a database connection” on your site: the site's config file has old details (after a migration or password change); check user, password and database name against cPanel. Queries hang: usually a query without an index on a table that grew. Running out of connections: your app opens connections and does not close them; it gets worse the longer it runs and clears on restart.

Frequently asked questions

Can you open my database to the whole internet? We do not recommend it; tell us your case. Can I allow a range? Yes; tell us which and why. I changed the user's password and the site broke: update it in the site's config file too. How many databases can I create? On current Cloud Web Hosting plans there is no limit on the number; what fills up is disk space. Reseller or older plans may have a cap, shown under “Account usage and information”.

If you will connect an external app, write to us with the public outbound IP and the database name. See also Why your IP was blocked.

More information


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 145