How to connect mySQL database in ShadowHoster Control Panel? Print

  • 1

ShadowHoster hosting uses StackCP (Control Panel) to manage databases and hosting services. This guide explains how to create a MySQL database, add a database user, and connect it to your website or application using StackCP.

This process is required for:

  • WordPress websites

  • PHP / custom applications

  • Dynamic websites that store data


Step-by-Step: MySQL Database Setup in StackCP

1️⃣ Log in to ShadowHoster StackCP

  • Open your StackCP login URL

  • Enter your username and password

  • Your hosting dashboard will appear


2️⃣ Open MySQL Databases

  • From the dashboard, go to Databases

  • Click on MySQL Databases

Here you can manage databases and users.


3️⃣ Create a New Database

  • Click Create Database

  • Enter a database name

  • Click Create

✅ Your MySQL database will be created successfully.


4️⃣ Create a Database User

  • Go to Database Users

  • Click Create User

  • Set a username and strong password

  • Save the user details

⚠️ Make sure to store the password securely.


5️⃣ Assign the User to the Database

  • Open Assign User to Database

  • Select the database

  • Select the database user

  • Enable All Privileges

  • Save changes

✔️ This allows your website to access the database.


Database Connection Details

You will need the following details to connect your website:

  • Database Host: Specified as Server before database name

  • Database Name: Your created database name

  • Username: Database user

  • Password: Database user password

These details are used in your website’s configuration file.

Example: PHP MySQL Connection

Use this example code to test the database connection:

<?php
$host = "server_name_provided_with_database";
$dbname = "your_database_name";
$username = "your_db_user";
$password = "your_db_password";

$conn = new mysqli($host, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Database connected successfully";
?>

Video Tutorial

Watch the full video guide:
https://youtu.be/IreSF2kGU0E


Was this answer helpful?

« Back