Skip to main content

Embedded local MySQL 5.5 server for portable Windows applications

Project description

⚠️ Windows-only. Embedded/local use only. ⚠️ Ships MySQL 5.5 binaries for local embedded use ⚠️ Not intended for networked or production servers

Q2MySQL55_Win_Local_Server

A lightweight, embedded-style MySQL 5.5 server wrapper for Windows, bundled inside your Python package.
Ideal for desktop applications that require a private MySQL instance without requiring the user to install MySQL.

This library:

  • Automatically finds mysqld.exe and mysqladmin.exe inside the package
  • Initializes the data directory on first run
  • Generates a minimal my.ini
  • Starts MySQL in detached mode (does not block Python)
  • Stops MySQL cleanly or forcefully
  • Requires no admin rights
  • Works only on Windows

✨ Features

  • ✔️ Ships MySQL 5.5 internally
  • ✔️ Auto-creates my.ini
  • ✔️ Auto-initializes data directories (mysql, performance_schema)
  • ✔️ Non-blocking background server start
  • ✔️ Graceful stop using mysqladmin
  • ✔️ No external installation required

📦 Package Structure

your_package/
    mysql55_files/
        bin/
            mysqld.exe
            mysqladmin.exe
        data/
            mysql/
            performance_schema/
    q2mysql55_win_local_server.py

🚀 Quick Start

from q2mysql55_win_local_server import Q2MySQL55_Win_Local_Server

DB_PATH = "test_mysql_data"
PORT = 3366

srv = Q2MySQL55_Win_Local_Server()
srv.start(PORT, DB_PATH)
print("Server started.")

# ... your logic ...

srv.stop()
print("Server stopped.")

⚙️ How It Works

1. Locating Binaries

The wrapper automatically resolves the folder mysql55_files using importlib.resources.

2. Data Directory Initialization

If missing, the following are copied from the embedded data/ directory:

  • mysql/
  • performance_schema/

3. Configuration (my.ini)

A minimal config is created automatically in the data directory:

[mysqld]
port=...
basedir=...
datadir=...
character-set-server=utf8
default-storage-engine=myisam
skip-innodb

4. Starting the Server

Runs mysqld.exe in fully detached mode using:

  • DETACHED_PROCESS
  • CREATE_NEW_PROCESS_GROUP

This allows the MySQL process to continue running independently.

5. Stopping the Server

Shutdown sequence:

  1. mysqladmin --user=root --port=... shutdown
  2. If server does not exit — terminate the process
  3. As a last resort — kill the process

⚠️ Requirements

  • Windows 10 or later
  • Python 3.9+
  • Bundled MySQL 5.5 distribution in mysql55_files

🔒 Security Notes

  • The server uses root with no password — do not expose it to any external network.
  • Intended only for local desktop applications.

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

q2mysql55_win_local-0.1.9.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

q2mysql55_win_local-0.1.9-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file q2mysql55_win_local-0.1.9.tar.gz.

File metadata

  • Download URL: q2mysql55_win_local-0.1.9.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for q2mysql55_win_local-0.1.9.tar.gz
Algorithm Hash digest
SHA256 9a260a6b2fa6dca8af29aef512e1dd1380789f9b246f2fa1c38e7f17d42ca154
MD5 2d2675e8af556f8fd5aafcd019640903
BLAKE2b-256 3ec5541dc3a542e3f725ac67d2142f19c01aecf4054443c4cbe3b23b6412d9e6

See more details on using hashes here.

File details

Details for the file q2mysql55_win_local-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for q2mysql55_win_local-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1819f4b1069109a1a255c04ef9393ac73114cfff19120e081690445abba4fbbf
MD5 00958ccaeb0015a94e074c40bdad0de5
BLAKE2b-256 fb8c9bf2390fdb927be0dbf821f36b60164dabcb7e42e7cd97dcb2956751cde5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page