Creating a database
Creating a database
What you'll learn: how to create a database for your website or app.
What's a database?
A database stores the dynamic content of your site — blog posts, user accounts, products, comments, settings. WordPress, for example, stores everything except your media files in a database.
If you're installing WordPress through the Installer, it creates the database for you — you don't need this article.
This article is for when you're setting up an app manually and need to create the database yourself.
Step 1 — Open the Databases page
Sidebar → Databases.
[screenshot here: Databases page]
Step 2 — Create the database
- Click New database.
- Give it a name. Use lowercase letters and underscores — like
mysite_mainorwordpress_blog. The panel may add a prefix automatically (something likeyouraccount_mysite_main) — that's fine, it's how databases are isolated between accounts. - Click Create.
Your database appears in the list. Note the full name — you'll need it.
Step 3 — Create a database user
A database needs a user to access it. Click Add user (or similar) and:
- Pick a username and a strong password.
- Click Create.
Then assign the user to the database (often there's an Add user to database button). Give the user all privileges unless your app says otherwise.
Save the database name, username, and password somewhere safe — you'll paste them into your app's configuration in a minute.
Step 4 — Use the database in your app
Most apps have a config file or installer that asks for:
- Database host — usually
localhost(or127.0.0.1) - Database name — the full name from step 2
- Username — from step 3
- Password — from step 3
Paste those in, save, and your app is connected.
Tips
- One database per app. Don't share a database between two apps — it makes upgrades and backups messier.
- Strong passwords matter. Database passwords are a common target for attackers. Use a long, random one (your password manager can generate it).
- Don't reuse passwords. Even between the database user and your panel — different layers, different passwords.
If something goes wrong
- "You've reached your database limit" — your hosting plan caps how many databases you can have. Delete an unused one or ask your provider for a bigger plan.
- App says "can't connect" — double-check the host (
localhost), the full database name (with prefix), and the password. - App says "access denied" — the user might not be assigned to the database, or might not have privileges. Check both in the panel.
What's next?
If you're managing data manually, see Using phpMyAdmin to manage your data.
Related articles