A dependency-free database console for WampServer / XAMPP, built to stay useful exactly when phpMyAdmin breaks and MySQL refuses to start.
Anyone running WampServer or XAMPP has lived this:
- You click phpMyAdmin and get a blank page, or
mysqli::real_connect(): Connection refused. - The WampServer icon is orange and
wampmysqld64refuses to start, with no readable explanation. - Your data is right there on disk, but you have no interface to reach it — and no idea why the engine stopped.
The catch is that phpMyAdmin needs a running MySQL in order to boot. When the engine dies, its management tool dies with it, and you are left alone with a command prompt and an error log a few hundred lines long.
This project closes exactly that gap:
| Situation | phpMyAdmin | This tool |
|---|---|---|
| MySQL running | ✅ Full management | ✅ Full management |
| MySQL down | ❌ Error page only | ✅ Root cause + start the service + recovery playbook |
| Port 3306 taken | ❌ Opaque connection error | ✅ Names the owning process, its PID, and the kill command |
| Corrupted InnoDB files | ❌ Nothing | ✅ Detects corruption, gives innodb_force_recovery steps and an emergency dump |
| No internet | ✅ Fully offline | |
| Two servers (MySQL + MariaDB) | ✅ One-click switching |
The core idea: the tool diagnoses and repairs without needing a working database. The Server Status page opens no database connection at all in order to render.
- Reads four independent signals: Windows service state, port listening, a real login attempt, and the tail of the engine error log.
- 13 detection rules for common boot failures. Each one reports the actual cause, ordered remediation steps, and ready-to-run commands pre-filled with your machine's real paths, with a copy button.
- Real control over Windows services (start / stop / restart), with every action appended to
var/service.log. - An ordered recovery playbook: physical copy → forced-recovery startup → full dump through
mysqldump.
Failures detected automatically from the log:
| Failure | What the tool does |
|---|---|
| Port conflict | Names the process holding the port and gives the kill command |
Unable to lock ibdata1 |
Detects a stale mysqld instance and how to terminate it |
| InnoDB page corruption | innodb_force_recovery plan from 1 to 6, plus an immediate dump |
| InnoDB engine failed to load | Back up first, then forced startup |
| Redo log size mismatch | How to restore innodb_log_file_size safely |
| Missing privilege tables | The exact data-directory initialisation command |
| Data directory from an older version | The correct upgrade path via dump and re-import |
Unknown option in my.ini |
Opens the file and runs the engine in console mode to surface the error |
| Data directory permissions | The correct icacls command for the service account |
| Disk full | Shows available space per drive |
| Crash recovery failed | Aria / MyISAM check and repair |
lower_case_table_names mismatch |
Explains why the engine refuses and how to fix it |
| Service not registered in Windows | The full --install command |
- Databases: create with an explicit charset and collation, protected drop (system schemas refused), size / table / row metrics.
- Tables: instant filtering, multi-select, bulk operations (export / optimize / drop), full structure editing (columns and indexes), truncate, drop.
- Records: paging, sorting, search across every column, plus insert / update / delete with composite primary key and explicit
NULLsupport. - Export: true streaming — dumps gigabyte-sized databases with flat memory usage, and emits non-UTF-8 payloads as hex so the dump stays re-importable.
- Import: a real SQL tokenizer that respects string literals, comments and
DELIMITER, so triggers and statements containing a semicolon inside a string no longer break apart.
- Runs several statements at once, with an independent report per statement: success, duration in milliseconds, row count, or the error message.
- Works without selecting a database — which is what you need to run
SHOW DATABASESorCREATE DATABASEwhile troubleshooting.
- Arabic / English with instant switching and automatic page direction (RTL / LTR).
- Dark and light themes following the system preference, with a manual override.
- Zero external dependencies: no CDN, no remote fonts, no framework. Icons are inline SVG — because the tool may well be used with no internet at all.
- Responsive, and honours
prefers-reduced-motion.
| Component | Minimum |
|---|---|
| PHP | 8.0+, with pdo_mysql |
| MySQL / MariaDB | 5.7 / 10.3+ |
| OS | Windows for service control and diagnostics. Everything else runs anywhere |
| Browser | Any modern browser |
No Composer, no node_modules. Copy the folder and open it.
git clone https://github.com/meroaidev/db-manager.git C:/wamp64/www/db-managerThen open:
http://127.0.0.1/db-manager/
The tool discovers the MySQL and MariaDB installation directories inside WampServer on its own, and reads my.ini for the port, data directory and error log path — so it keeps working after a WampServer upgrade renames those folders.
Do not edit config/config.php directly. Create config/config.local.php and return only what you want to override:
<?php
return [
'servers' => [
'mysql' => [
'username' => 'root',
'password' => 'your_password',
],
],
'security' => [
'allow_service_control' => true,
],
];That file is git-ignored, so credentials never reach the repository.
This is a local development tool with broad powers: arbitrary SQL, dropping databases, controlling Windows services. Therefore:
- Local only. Any request not coming from
127.0.0.1or::1is rejected, enforced both in PHP and in.htaccess. - CSRF protected. Every state-changing operation is a POST carrying a token. Links never delete anything.
- Prepared statements. All values are bound; all identifiers are verified against the catalogue before being quoted.
- System schemas protected.
mysql,information_schema,performance_schemaandsyscannot be dropped. - Service allow-list. Only service names declared in configuration can be controlled, and every action is logged.
- Closed directories.
lib/,config/,lang/,views/andvar/are not directly reachable.
⚠️ Never expose this tool on a public server. It is designed for a local development machine.
db-manager/
├── index.php ← Dashboard
├── manage_databases.php ← Create and drop databases
├── view_tables.php ← Tables of a database + bulk actions
├── view_table_data.php ← Row browser
├── add_record.php ← Insert a record
├── edit_record.php ← Update a record
├── delete_record.php ← Delete a record (POST only)
├── create_table.php ← Table builder
├── manage_table_structure.php ← Columns, indexes and maintenance
├── drop_table.php ← Drop a table (POST only)
├── sql_query.php ← SQL console
├── import_database.php ← SQL file import
├── export.php ← Streaming export
├── server_status.php ← Diagnostics and recovery
│
├── config/config.php ← Configuration (override with config.local.php)
├── lang/{ar,en}.php ← Translation catalogues
├── assets/{app.css,app.js} ← Design system and interface behaviour
├── docs/ ← Documentation images
├── var/ ← Logs and generated files
│
├── views/
│ ├── layout.php ← Shared shell
│ ├── pages/ ← One template per page
│ └── partials/ ← Shared components
│
└── lib/
├── bootstrap.php ← Entry point and autoloading
├── helpers.php ← Global helper functions
├── Runtime.php ← Configuration container
├── Server.php ← One server described
├── ServerRegistry.php ← Server discovery and my.ini parsing
├── Database.php ← Connections and automatic failover
├── ConnectionException.php
├── Schema.php ← Every metadata read and DDL/DML write
├── Exporter.php ← Streaming dump writer
├── Importer.php ← SQL file tokenizer and executor
├── SqlRunner.php ← Ad-hoc query execution
├── ServerDiagnostics.php ← Failure detection engine
├── SystemState.php ← Windows service and port facts
├── ServiceControl.php ← Start / stop services
├── Shell.php ← External command execution
├── Security.php ← CSRF and access control
├── Page.php ← Shared request guards
├── View.php ← Template renderer
├── Lang.php ← Translation
└── Icons.php ← Inline SVG icon set
A few decisions worth explaining:
- The status page does not wait on Windows unnecessarily. Spawning PowerShell costs seconds on Windows. So the cheap signals run first (a TCP probe and a login attempt), and PowerShell is only invoked when they reveal a problem — and then everything needed is collected in a single call. Load time went from 29 seconds to under 0.3.
- PowerShell instead of
netandsc. Their output is localised by Windows display language and cannot be parsed reliably, whereasServiceControllerStatusis culture-invariant. - The exporter writes straight to the output stream using an unbuffered query, so the dump is never materialised in memory.
- The importer uses a real tokenizer that tracks quoting and comment state across lines, instead of
explode(';')which shreds any statement containing a semicolon inside a string. - Every user-facing string is a translation key (328 per language), with the English catalogue acting as the fallback, so a missing key never blanks the interface.
MIT
كل من يعمل على WampServer أو XAMPP مرّ بهذا السيناريو:
- تضغط على phpMyAdmin فتظهر صفحة بيضاء أو خطأ
mysqli::real_connect(): Connection refused. - أيقونة WampServer برتقالية، وخدمة
wampmysqld64ترفض الإقلاع بلا رسالة مفهومة. - بياناتك موجودة على القرص، لكن لا تملك أي واجهة للوصول إليها ولا حتى لمعرفة سبب التوقف.
المشكلة أن phpMyAdmin نفسه يحتاج MySQL عاملاً ليقلع. فإذا سقط المحرك سقطت معه أداة إدارته، وتُترك أمام سطر أوامر وسجل أخطاء بمئات الأسطر.
هذا المشروع يعالج تلك الفجوة تحديداً:
| الحالة | phpMyAdmin | هذه الأداة |
|---|---|---|
| MySQL يعمل | ✅ إدارة كاملة | ✅ إدارة كاملة |
| MySQL متوقف | ❌ صفحة خطأ فقط | ✅ تشخيص السبب + تشغيل الخدمة + خطة استرجاع |
| منفذ 3306 محجوز | ❌ خطأ اتصال مبهم | ✅ تسمية العملية المحتلة ورقمها وأمر إنهائها |
| تلف في ملفات InnoDB | ❌ لا شيء | ✅ كشف التلف + أوامر innodb_force_recovery + تصدير طارئ |
| لا يوجد إنترنت | ✅ يعمل بالكامل دون اتصال | |
| خادمان (MySQL و MariaDB) | ✅ تبديل فوري بين الخوادم |
الفكرة الأساسية: الأداة تُشخّص وتُصلح دون أن تحتاج قاعدة بيانات عاملة. صفحة "حالة الخوادم" لا تفتح أي اتصال بقاعدة بيانات لكي تُعرض.
- فحص مباشر لأربع إشارات مستقلة: حالة خدمة Windows، إصغاء المنفذ، محاولة دخول فعلية، وذيل سجل أخطاء المحرك.
- ١٣ قاعدة كشف لأعطال الإقلاع الشائعة، كل واحدة تعطي السبب الحقيقي وخطوات مرتّبة وأوامر جاهزة بمسارات جهازك الفعلية مع زر نسخ.
- تحكم فعلي في خدمات Windows (تشغيل/إيقاف/إعادة تشغيل) مع تسجيل كل عملية في
var/service.log. - خطة استرجاع مرتّبة: نسخة فيزيائية ← إقلاع بالاسترجاع القسري ← تصدير كامل عبر
mysqldump.
الأعطال التي تُكتشف تلقائياً من السجل: تعارض المنفذ، قفل ibdata1، تلف صفحات InnoDB، فشل تحميل المحرك، عدم تطابق حجم redo log، فقدان جداول الصلاحيات، مجلد بيانات لإصدار أقدم، خيار غير معروف في my.ini، نقص صلاحيات مجلد البيانات، امتلاء القرص، فشل الاسترجاع بعد إغلاق غير نظيف، تعارض lower_case_table_names، وخدمة غير مسجّلة في Windows.
- قواعد البيانات: إنشاء بترميز وترتيب مقارنة محدّدين، حذف محمي (قواعد النظام مرفوضة)، وعرض الحجم وعدد الجداول والسجلات.
- الجداول: تصفية فورية، تحديد متعدد، عمليات جماعية (تصدير / تحسين / حذف)، بنية كاملة (أعمدة وفهارس)، تفريغ، وحذف.
- السجلات: تصفّح مع ترقيم وترتيب وبحث في كل الأعمدة، وإضافة وتعديل وحذف مع دعم المفاتيح المركّبة و
NULLالصريح. - التصدير: تدفّق مباشر يصدّر قواعد بحجم غيغابايت دون استهلاك الذاكرة، مع إخراج البيانات الثنائية بصيغة hex.
- الاستيراد: محلّل جمل SQL حقيقي يحترم النصوص والتعليقات و
DELIMITER، فلا تنكسر المشغّلات ولا الجمل التي تحتوي فاصلة منقوطة داخل نص.
- تنفيذ عدة أوامر دفعة واحدة، مع تقرير مستقل لكل أمر: النجاح، الزمن بالمللي ثانية، عدد الصفوف، أو رسالة الخطأ.
- تعمل بدون تحديد قاعدة بيانات، وهو ما تحتاجه لتنفيذ
SHOW DATABASESأوCREATE DATABASEأثناء استكشاف الأعطال.
- عربي وإنجليزي مع تبديل فوري واتجاه صفحة تلقائي (RTL / LTR).
- وضع ليلي ونهاري يتبع إعداد النظام مع إمكانية التثبيت اليدوي.
- بلا اعتماديات خارجية: لا CDN ولا خطوط بعيدة ولا إطار عمل. الأيقونات SVG مدمجة، لأن الأداة قد تُستخدم دون إنترنت.
- متجاوبة، وتحترم
prefers-reduced-motion.
| المكوّن | الحد الأدنى |
|---|---|
| PHP | 8.0 فأعلى مع pdo_mysql |
| MySQL / MariaDB | 5.7 / 10.3 فأعلى |
| النظام | Windows لميزات التحكم في الخدمات والتشخيص، وباقي المزايا تعمل على أي نظام |
| المتصفح | أي متصفح حديث |
لا يوجد Composer ولا node_modules. انسخ المجلد وشغّل.
git clone https://github.com/meroaidev/db-manager.git C:/wamp64/www/db-managerثم افتح http://127.0.0.1/db-manager/.
الأداة تكتشف تلقائياً مسارات تثبيت MySQL و MariaDB داخل WampServer، وتقرأ my.ini لمعرفة المنفذ ومجلد البيانات ومسار سجل الأخطاء، لذلك تستمر بالعمل بعد ترقية WampServer التي تغيّر أسماء المجلدات.
لا تعدّل config/config.php مباشرة. أنشئ config/config.local.php وأعد فيه ما تريد تغييره فقط (الملف مستثنى من Git فلا تُرفع كلمات المرور):
<?php
return [
'servers' => [
'mysql' => [
'username' => 'root',
'password' => 'your_password',
],
],
];هذه أداة تطوير محلية تملك صلاحيات واسعة (تنفيذ SQL حر، حذف قواعد بيانات، التحكم في خدمات Windows). لذلك:
- مقصورة على الجهاز المحلي: تُرفض أي طلب من غير
127.0.0.1أو::1، ويُفرض ذلك في PHP وفي.htaccessمعاً. - حماية CSRF: كل عملية تغيّر حالة تتم عبر POST مع رمز تحقق، والروابط لا تحذف شيئاً أبداً.
- جمل مُعدّة مسبقاً: كل القيم تُمرَّر كمعاملات، وكل المعرّفات يُتحقق من وجودها في الكتالوج ثم تُقتبس.
- قواعد النظام محمية من الحذف، وقائمة بيضاء للخدمات لا يمكن تجاوزها، وكل عملية تُسجَّل.
- مجلدات مغلقة:
lib/وconfig/وlang/وviews/وvar/محجوبة عن الوصول المباشر.
⚠️ لا تنشر هذه الأداة على خادم عام. هي مصمّمة لبيئة التطوير المحلية فقط.
- صفحة الحالة لا تنتظر Windows بلا داعٍ. استدعاء PowerShell يكلّف ثوانٍ، لذلك تُقرأ الإشارات الرخيصة أولاً (فحص TCP ومحاولة دخول)، ولا يُستدعى PowerShell إلا إذا أظهرت خللاً، وعندها يُجمع كل ما يلزم في استدعاء واحد. النتيجة: زمن التحميل انخفض من ٢٩ ثانية إلى أقل من ٠٫٣ ثانية.
- PowerShell بدل
netوsc: مخرجاتهما مترجمة حسب لغة ويندوز ولا يمكن تحليلها بثقة، بينماServiceControllerStatusثابت مهما كانت لغة النظام. - التصدير يكتب مباشرة إلى المخرج ويستخدم استعلاماً غير مُخزَّن، فلا يُبنى الملف في الذاكرة.
- الاستيراد يستخدم محلّلاً حقيقياً يتتبّع حالة الاقتباس والتعليقات عبر الأسطر، بدل
explode(';')الذي يكسر أي جملة تحتوي فاصلة منقوطة داخل نص. - كل النصوص مفاتيح ترجمة (٣٢٨ مفتاحاً لكل لغة)، وقاموس الإنجليزية هو الاحتياطي، فلا تظهر واجهة فارغة عند نقص مفتاح.
MIT



