Introduction
Every plan includes MySQL databases, per-database users, and a link to phpMyAdmin. If your application needs PostgreSQL or Redis, both are included on every Laravel Hosting and Node.js Hosting plan, and from Business on Linux. This guide covers creating a database, connecting your application to it, and importing and exporting data.
Creating a Database and User
In the panel, open your site and go to Databases. Add database creates the database. Names receive your account’s prefix automatically, so shop becomes something like yoursite1_shop. You should use the full prefixed name everywhere.
Add user creates a database user with its own password. Access is granted per database, so one user may reach every database on a site while another reaches only one. A typical application needs one database and one user.
Using phpMyAdmin
Your site’s overview page has a phpMyAdmin quick link that signs you in directly, so there is no separate username or password to store. From phpMyAdmin, you may browse tables, run queries, and edit values.
Connecting Your Application
Your application’s configuration needs four values: the prefixed database name, the username, the password, and the host. The first three are on the Databases page. The host should always be localhost:
DB_HOST=localhost
Warning: Do not use
127.0.0.1. Sites run in their own containers, and inside a container127.0.0.1is the container’s own empty loopback.localhostroutes through the socket your site is permitted to use. An application that connects elsewhere but is refused here with correct credentials usually has this setting wrong.
Importing and Exporting
phpMyAdmin handles both operations. Exporting produces a .sql file of your database. You should export before any risky change, such as a large plugin update, a framework migration, or a manual query. Importing accepts the same format.
For databases too large for a browser upload, run the import over SSH, or attach the file to a support ticket and we will load it for you.
Remote Connections
Database access is scoped per user, and by default a user’s access is local to the server. This keeps your database from accepting connections from the whole internet, where it would be open to brute force attempts.
phpMyAdmin covers the browsing and querying that a desktop client is usually needed for. If your workflow requires a direct remote connection, open a ticket and we will set it up for the specific user and source address.