3 min read Sep 26, 2026

Using MySQL on Windows Hosting with PHP, ASP.NET or Classic ASP

Create a MySQL database on Windows Hosting and connect from PHP (PDO), ASP.NET (MySqlConnector) or Classic ASP (ODBC), with the correct host and settings.

FimuroHost Team

FimuroHost Team

Technical Writer

Share Article

Windows Hosting isn't limited to MS SQL. You can also create MySQL databases (MariaDB, which is MySQL-compatible) and use them from PHP, ASP.NET or Classic ASP. MySQL is the natural choice for PHP applications, and it is also useful for .NET sites that don't need SQL Server features.

Step 1: Create the database

  1. Log in to your FimuroHost client area at https://app.fimurohost.com.
  2. Open Services and select your Windows Hosting plan (Starter, Premium or Business).
  3. Click Login to Control Panel. StackCP opens for that website, already signed in.
  4. In Web Tools, click MySQL Databases.
  5. Enter a name (6 to 20 characters) and create the database. StackCP adds a short suffix to the name.
  6. Note the full database name, the username, the password you set and the database hostname shown on the page.

Each MySQL database can currently hold up to 1 GB. More detail is in How to Create a MySQL Database in StackCP.

Step 2: Use the right host (not localhost)

MySQL runs on separate database servers, so localhost or 127.0.0.1 will not work. Always copy the hostname from the MySQL Databases page; it looks similar to shareddb1b.hosting.stackcp.net, but yours may differ. Why this is: Why You Can't Use localhost as Your Database Host.

PHP (PDO)

<?php
$host = 'your-db-host.hosting.stackcp.net';
$db   = 'shopdb-3a1f';
$user = 'shopdb-3a1f';
$pass = 'YourStrongPassword';

$dsn = "mysql:host=$host;dbname=$db;charset=utf8mb4";
$pdo = new PDO($dsn, $user, $pass, [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);

$stmt = $pdo->prepare('SELECT name FROM products WHERE category_id = ?');
$stmt->execute([3]);
foreach ($stmt as $row) {
    echo htmlspecialchars($row['name']), '<br>';
}

mysqli works too. The old mysql_connect() functions were removed in PHP 7; see Fix “Call to undefined function mysql_connect()”.

ASP.NET (.NET Framework)

Install the free MySqlConnector package from NuGet (it supports .NET Framework 4.6.2 and later). In Visual Studio: Tools → NuGet Package Manager → Package Manager Console, then run Install-Package MySqlConnector. The DLL is copied to bin when you publish, so nothing needs installing on the server.

<connectionStrings>
  <add name="MySqlDb"
       connectionString="Server=your-db-host.hosting.stackcp.net;Database=shopdb-3a1f;User ID=shopdb-3a1f;Password=YourStrongPassword;CharSet=utf8mb4;" />
</connectionStrings>

Then query it with parameters:

using MySqlConnector;
using System.Configuration;

var cs = ConfigurationManager.ConnectionStrings["MySqlDb"].ConnectionString;
using (var conn = new MySqlConnection(cs))
{
    conn.Open();
    using (var cmd = new MySqlCommand("SELECT name FROM products WHERE category_id = @cat", conn))
    {
        cmd.Parameters.AddWithValue("@cat", 3);
        using (var reader = cmd.ExecuteReader())
        {
            while (reader.Read()) { var name = reader.GetString(0); }
        }
    }
}

Oracle's MySql.Data package also works if your project already uses it; the connection string format is the same.

Classic ASP (ODBC)

Classic ASP connects to MySQL through the MySQL ODBC driver on the server:

<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={MySQL ODBC 5.3 Unicode Driver};" & _
          "Server=your-db-host.hosting.stackcp.net;Database=shopdb-3a1f;" & _
          "Uid=shopdb-3a1f;Pwd=YourStrongPassword;Option=3;"
%>

If you get “Data source name not found and no default driver specified”, the driver name in your string doesn't match the one installed on the server. Open a ticket and we will confirm the exact driver name to use.

Managing the data

  • Use phpMyAdmin from the MySQL Databases page to browse tables, run queries and import or export .sql files. See How to Import a .sql File with phpMyAdmin.
  • Store text as utf8mb4 so Bangla text and emoji are saved correctly.
  • Keep your own backups by exporting from phpMyAdmin regularly.

Common problems

  • “Can't connect to MySQL server on ‘localhost’” – use the hostname from StackCP.
  • “Access denied for user” – wrong password or missing name suffix. Reset the password in StackCP and copy the names again.
  • “Unknown database” – the database name is missing its suffix.

Need help?

If something doesn't work as described, open a support ticket from your client area or message us on WhatsApp at 01818160926. Tell us your domain name and the exact error message, and we will take it from there.

FimuroHost Team

Written by

FimuroHost Team

Technical Writer