Introduction #
A database stores the structured data your website needs, and your hosting account provides the tools to create and connect that database through cPanel. The most important part is making sure the database, user, permissions, and website configuration all match correctly, you’ll learn more about that in this doc.
What are databases for Web Hosting #
Databases are an important part of many modern websites. If a website uses dynamic content, user accounts, settings, forms, or application data, it will usually rely on a database to store and retrieve that information. On ProRedLine Web Hosting and Site Hosting packages, MySQL databases can be used for this purpose.
This is especially relevant for websites or applications that are installed manually or configured outside of automatic tools. For example, WordPress installations created through WP Toolkit handle much of the database setup automatically. In other cases, the database may need to be created and connected manually.
What a Database Is Used For #
A MySQL database stores structured data that a website or web application needs in order to function. Instead of keeping everything inside static files, dynamic websites store important information in a database and load it when needed.
Examples of data that may be stored in a database include:
- website content
- user accounts
- passwords or authentication-related data
- settings and configuration values
- form submissions
- e-commerce data such as orders or customer details
Because of this, databases are essential for many PHP-based websites and applications. Static websites, on the other hand, usually do not require a database at all.
When You Need a Database #
A database is typically required when you are hosting a dynamic website or application. This includes many content management systems, custom PHP applications, and other software that needs to store and update data over time.
You may not need a database if your website is fully static and consists only of files such as HTML, CSS, JavaScript, and images.
If you are manually installing a website or application, it is important to know in advance whether that software requires a database and what type of access details it expects.
Before You Create a Database #
Before setting up a database, you should make sure that:
- you have an active Web Hosting or Site Hosting service
- you have access to cPanel
- you know which website or application will use the database
- you understand the database limits of your hosting package
It is also helpful to know whether the application expects a new empty database or whether you will later import existing database content from a backup or migration.
Creating and Assigning a Database (User) #
After creating the database, you also need to create a database user and assign that user to the database with the correct permissions. Without this step, the website or application will not be able to connect.
For most websites and applications, the database user should be assigned with All Privileges, so the application can fully manage its own data.
Because the full database setup inside cPanel is explained in more detail elsewhere, see: Databases in cPanel
Using the Database with Your Website #
After the database and user have been created, the website or application still needs to be configured to use them. In most cases, the following details are required:
- database name
- database username
- database password
- database host
These details are usually entered into the application during installation or placed in a configuration file.
For many normal hosting setups, the database host is the local server environment unless the application or setup instructions state otherwise. The most important part is that the credentials entered into the website exactly match what was created in cPanel.
If any of these values are wrong, the website will not be able to connect to the database.
Common Use Cases #
Manual database setup is commonly needed when:
- manually installing WordPress or another CMS
- setting up a PHP-based website outside of automatic tools
- migrating an existing website to your ProRedLine hosting account
- restoring a database from backup
- configuring a custom web application
In these situations, creating the database is only part of the setup. The site or application must also be correctly linked to it.
Common Problems #
Database-related issues are often caused by one of the following:
- the wrong database name being used
- the wrong database user being used
- an incorrect password
- the user not being assigned to the database
- missing permissions
- the wrong database host being entered
- importing or restoring data into the wrong database
Because these errors often look similar from the website side, it is important to check all connection details carefully if the site cannot connect.
Verifying the Setup #
After the database has been connected to the website, the connection should be tested through the application itself. If the website installs correctly or starts loading dynamic content as expected, the database connection is usually working.
If the website reports a database connection error, the first step is to review the database name, username, password, assigned permissions, and host value exactly as they are configured in cPanel.
Final Notes #
Databases are one of the core building blocks of dynamic websites on Web Hosting and Site Hosting. While automatic tools may handle this setup in some cases, manual database creation is still an important part of hosting websites that are installed, migrated, or configured manually.
Still need help after reading this article?
