# MySQL Dump Browser Browser-based viewer for MySQL dump files, powered by **React + vinext + sql.js**. It imports SQL dumps into an in-browser SQLite engine, then lets you browse tables and run ad-hoc queries. ## Features - Client-side import of `.sql` and `.sql.gz` files - MySQL-to-SQLite statement rewriting for common dump patterns - SQL execution in a Web Worker (UI stays responsive) - Import progress updates + cancel support - Table list, pagination, and custom query panel ## Requirements - Node.js 18+ - npm 9+ ## Local development ```bash npm install npm run dev ``` Open: `http://localhost:3000` Useful scripts: ```bash npm run check npm run build npm run start ``` ## Import notes ### Single-file dumps Most standard `mysqldump` exports work directly. ### Multi-file scripts (for example `datacharmer/test_db`) `employees.sql` from `test_db` references other files via `SOURCE ...` statements. A browser file upload cannot automatically open those referenced local files. Current behavior: - `SOURCE` statements are detected and logged as hints - You should import the referenced `.dump` files manually after importing `employees.sql` Suggested order for `test_db`: 1. `employees.sql` 2. `load_departments.dump` 3. `load_employees.dump` 4. `load_dept_emp.dump` 5. `load_dept_manager.dump` 6. `load_titles.dump` 7. `load_salaries1.dump` 8. `load_salaries2.dump` 9. `load_salaries3.dump` ## Deploy to Cloudflare Workers vinext includes first-class Workers deploy support. ### 1) One-time setup Authenticate Wrangler: ```bash npx wrangler login ``` (For CI, use `CLOUDFLARE_API_TOKEN` instead of interactive login.) ### 2) Deploy Preview what vinext will generate: ```bash npm run deploy:dry-run ``` Deploy to production: ```bash npm run deploy ``` Deploy to preview environment: ```bash npm run deploy:preview ``` `vinext deploy` auto-generates missing Worker config and runs Wrangler deploy. ## Attach a custom domain ### Option A (recommended): Cloudflare Dashboard 1. Go to **Workers & Pages** 2. Open this Worker 3. Go to **Settings → Domains & Routes** 4. Click **Add → Custom Domain** 5. Enter your domain/subdomain (for example `sql.example.com`) 6. Save and wait for certificate issuance ### Option B: Wrangler config as code Add a custom domain route in your Worker config (`wrangler.jsonc` or `wrangler.toml`), then deploy. `wrangler.toml` example: ```toml [[routes]] pattern = "sql.example.com" custom_domain = true ``` Then: ```bash npx wrangler deploy ``` ## Notes - Custom domains work when your DNS zone is on Cloudflare. - If a record already exists for the same hostname, remove/replace it before attaching the Worker custom domain.