⚠️ 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.exeandmysqladmin.exeinside 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_PROCESSCREATE_NEW_PROCESS_GROUP
This allows the MySQL process to continue running independently.
5. Stopping the Server
Shutdown sequence:
mysqladmin --user=root --port=... shutdown- If server does not exit — terminate the process
- 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
Metadata
Release files for q2mysql55-win-local 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| q2mysql55_win_local-0.1.9.tar.gz | 4.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| q2mysql55_win_local-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 MB
Release files / q2mysql55_win_local-0.1.9.tar.gz
| Download URL | q2mysql55_win_local-0.1.9.tar.gz |
|---|---|
| Size | 4.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a260a6b2fa6dca8af29aef512e1dd1380789f9b246f2fa1c38e7f17d42ca154
|
|
BLAKE2b-256 checksum How to use checksums |
3ec5541dc3a542e3f725ac67d2142f19c01aecf4054443c4cbe3b23b6412d9e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / q2mysql55_win_local-0.1.9-py3-none-any.whl
| Download URL | q2mysql55_win_local-0.1.9-py3-none-any.whl |
|---|---|
| Size | 4.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1819f4b1069109a1a255c04ef9393ac73114cfff19120e081690445abba4fbbf
|
|
BLAKE2b-256 checksum How to use checksums |
fb8c9bf2390fdb927be0dbf821f36b60164dabcb7e42e7cd97dcb2956751cde5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|