SQL Wizard

Your own database server

Run MariaDB or MySQL on a NAS or a computer at home or in the office, and reach it from SQL Wizard over the internet.

How it fits together

The SQL Wizard service runs on the internet, so it must reach your database server from outside your network. Four things make that work: the database server listens on the network, your router forwards port 3306 to it, a DDNS name finds your home or office address, and a MySQL user is allowed from SQL Wizard’s address only.

  • Database server: MariaDB or MySQL on a NAS (Synology, QNAP), a Windows PC (MariaDB on its own, or WAMP) or Linux.
  • Router: forwards port 3306 from the internet to that machine. Most routers need this by hand; a Synology can do it by itself when the router allows it (UPnP).
  • DDNS: a name such as yourname.duckdns.org that always points to your current internet address.
  • A MySQL user only for SQL Wizard, allowed from SQL Wizard’s address 91.234.46.58, with rights on the databases it needs — never root.
  • Then Database serversAdd server in SQL Wizard: the DDNS name, port 3306 and that user.
The SQL Wizard service reaches only port 3306 of your server. If MariaDB listens on another port (Synology and WAMP use 3307), let the router forward 3306 from outside to that port inside.
Open in SQL Wizard

GuideMariaDB on a Synology NAS

For DSM 7. The MariaDB 10 package from the Package Center.

  1. Package CenterMariaDB 10Install. Set a strong password for root when it asks.
  2. Open MariaDB 10: tick Enable TCP/IP connection. Its port is 3307; you may change it to 3306 there (only if MariaDB 5 is not installed).
  3. Package CenterphpMyAdminInstall (optional, to make the user and databases in a browser) — or use Basic SQL in SQL Wizard on your own PC.
  4. Make the user for SQL Wizard (see “A MySQL user for SQL Wizard”).
  5. Control PanelSecurityFirewall: allow TCP 3306 (or 3307) from SQL Wizard’s address 91.234.46.58, and everything from your own network; deny the rest.
  6. Control PanelExternal AccessDDNSAdd: provider Synology, a name such as yourname.synology.me.
  7. Port forwarding: Control PanelExternal AccessRouter Configuration can set it by itself when your router allows UPnP; otherwise in the router by hand (see “Port forwarding on your router”): outside TCP 3306 → the NAS, port 3306 or 3307.
  8. In SQL Wizard: Database serversAdd server: yourname.synology.me, port 3306, the user for SQL Wizard; Test.
MariaDB on the NAS has no encryption (TLS) set up: the password and the data travel unencrypted. Use a long password and allow only SQL Wizard’s address 91.234.46.58; for sensitive data set up TLS on MariaDB first.
Open in SQL Wizard

GuideMariaDB on a QNAP NAS

For QTS 5 and QuTS hero.

  1. App CenterMariaDB 10Install (older QTS: Control PanelApplicationsSQL serverEnable MySQL server).
  2. Open its settings: set the root password, switch on TCP/IP networking and note the port it shows (3306 or 3307).
  3. Make the user for SQL Wizard (see “A MySQL user for SQL Wizard”); phpMyAdmin is in the App Center too.
  4. QuFirewall: allow TCP on that port from SQL Wizard’s address 91.234.46.58 and everything from your own network; deny the rest.
  5. myQNAPcloudMy DDNS: switch it on and note the name (yourname.myqnapcloud.com).
  6. Port forwarding in the router by hand (see “Port forwarding on your router”): outside TCP 3306 → the NAS, its MariaDB port. myQNAPcloudAuto Router Configuration can do it when the router allows UPnP.
  7. In SQL Wizard: Database serversAdd server: yourname.myqnapcloud.com, port 3306, the user for SQL Wizard; Test.
Open in SQL Wizard

GuideMariaDB on a Windows computer

MariaDB on its own, as a Windows service. The computer must stay on (and not sleep) while SQL Wizard uses it.

  1. Download the MSI installer from mariadb.org (DownloadMariaDB Server, the current long-term version) and run it.
  2. Set a strong root password. Leave “Enable access from remote machines for root” off — SQL Wizard gets its own user.
  3. Keep Enable networking on, port 3306, and Install as service (it starts with Windows).
  4. Make the user for SQL Wizard (see “A MySQL user for SQL Wizard”): open the MySQL Client from the Start menu, or HeidiSQL that comes with it.
  5. Windows Defender FirewallAdvanced settingsInbound RulesNew Rule: Port, TCP 3306, Allow; on its Scope tab, Remote IP address: only SQL Wizard’s address 91.234.46.58 (and your own network if other PCs use it).
  6. SettingsSystemPower: never sleep while it is plugged in.
  7. Give the PC a fixed address in your network (a DHCP reservation in the router), set up port forwarding (outside TCP 3306 → this PC, 3306) and a DDNS name (see the guides below).
  8. In SQL Wizard: Database serversAdd server: the DDNS name, port 3306, the user for SQL Wizard; Test.
Open in SQL Wizard

GuideMySQL or MariaDB in WAMP (Windows)

WampServer brings MySQL and MariaDB with it. Good for development; for others to use it the PC must stay on.

  1. Left-click the WAMP iconMariaDB (or MySQL): see which one runs and its port — WampServer 3 gives MySQL port 3306 and MariaDB port 3307.
  2. WAMP iconMariaDBmy.ini: under [mysqld] the line bind-address must be bind-address = 0.0.0.0 (or be missing), otherwise it listens only to this PC. Save, then WAMP iconRestart All Services.
  3. Make the user for SQL Wizard (see “A MySQL user for SQL Wizard”) — phpMyAdmin is at http://localhost/phpmyadmin.
  4. Windows Defender Firewall: an inbound rule for TCP 3306 (or 3307) from SQL Wizard’s address 91.234.46.58 only, as in “MariaDB on a Windows computer”.
  5. Port forwarding: outside TCP 3306 → this PC, 3306 for MySQL or 3307 for MariaDB; and a DDNS name.
  6. In SQL Wizard: Database serversAdd server: the DDNS name, port 3306, the user for SQL Wizard; Test.
WAMP’s own root user has no password: never forward a port to a WAMP whose root has no password. Set one in phpMyAdmin first (User accountsrootChange password).
Open in SQL Wizard

GuideMariaDB or MySQL on Linux

Debian and Ubuntu; other systems are much the same.

  1. sudo apt install mariadb-server, then sudo mariadb-secure-installation (a root password, no anonymous users, no test database).
  2. In /etc/mysql/mariadb.conf.d/50-server.cnf (MySQL: /etc/mysql/mysql.conf.d/mysqld.cnf) set bind-address = 0.0.0.0, then sudo systemctl restart mariadb.
  3. Make the user for SQL Wizard: sudo mariadb, then the SQL in “A MySQL user for SQL Wizard”.
  4. Firewall: sudo ufw allow from 91.234.46.58 to any port 3306 proto tcp.
  5. At home or in an office behind a router: port forwarding and a DDNS name (the guides below); a server with a public address needs neither.
  6. In SQL Wizard: Database serversAdd server; Test.
Open in SQL Wizard

GuidePort forwarding on your router

The router decides which machine in your network gets a connection from the internet. Every router names it a little differently: Port Forwarding, Virtual Server, NAT, Port mapping or Applications.

  1. Give the database machine a fixed address in your network: in the router, DHCPreservation (or Static lease) for it, for example 192.168.1.50.
  2. Open the router’s page in a browser: usually http://192.168.1.1 or http://192.168.0.1 (it is printed on the router, with the password).
  3. Find Port Forwarding (or Virtual Server / NAT) and add a rule: protocol TCP, outside port 3306, inside address 192.168.1.50, inside port 3306 (3307 for Synology’s MariaDB 10 or WAMP’s MariaDB).
  4. Save. Some routers want a restart.
  5. Check from outside: in SQL Wizard, Database serversAdd serverTest. “Connection refused” or a time-out mean the forwarding or a firewall still blocks it.
If the router’s internet address (on its status page) is not the one https://api.ipify.org shows, or it starts with 100.64 or 10., your provider shares one address among customers (CGNAT) and forwarding can’t work: ask the provider for a public IP address.
Forward only port 3306, never “DMZ” or all ports.
A router of your internet provider may let you change this only in its app or through support.
Open in SQL Wizard

GuideA name for your address (DDNS)

At home or in a small office the internet address usually changes now and then. DDNS gives you a name that always points to the current address: SQL Wizard connects to the name.

  1. Choose where the name comes from: your router (many have DDNS built in), your NAS (Synology: yourname.synology.me; QNAP: myQNAPcloud), or a free service such as DuckDNS or No-IP.
  2. Router: find DDNS (often under Internet or WAN), choose the service, sign in with its account, save. The router updates the name whenever the address changes.
  3. DuckDNS: sign in at duckdns.org, add a sub domain (yourname.duckdns.org), then let something update it — the router if it supports DuckDNS, or the DuckDNS updater on the PC that is always on.
  4. No-IP: make a free host name at noip.com and install its Dynamic Update Client on an always-on PC (the free name has to be confirmed every 30 days).
  5. Check: nslookup yourname.duckdns.org in Command Prompt shows the same address as https://api.ipify.org.
  6. In SQL Wizard: use the name as the server in Database servers.
An office with a fixed address from its provider needs no DDNS: use the address (or a name in your company’s domain) directly.
Open in SQL Wizard

GuideA MySQL user for SQL Wizard

Its own user, allowed only from SQL Wizard’s address, with rights only where it needs them. Run the SQL as root on the server (phpMyAdmin, HeidiSQL, the mariadb command, or Basic SQL in SQL Wizard on your own PC).

  1. CREATE USER 'sqlwizard'@'91.234.46.58' IDENTIFIED BY 'a long password';
  2. All rights on one database: GRANT ALL PRIVILEGES ON shop.* TO 'sqlwizard'@'91.234.46.58'; — on every database (also creating new ones): GRANT ALL PRIVILEGES ON *.* TO 'sqlwizard'@'91.234.46.58';
  3. Only to look: GRANT SELECT, SHOW VIEW ON shop.* TO 'sqlwizard'@'91.234.46.58';
  4. In SQL Wizard: Database servers → the server → its login: user sqlwizard and the password.
The address in the user ('sqlwizard'@'…') is where SQL Wizard connects from: SQL Wizard’s address 91.234.46.58. For your own PC in the same network use 'sqlwizard'@'192.168.1.%'.
Never allow root from outside, and never '%' (everyone) for a server on the internet.
Open in SQL Wizard

GuideAdd your server in SQL Wizard

Owners and admins of an organization: Database serversAdd server.

  1. Name: anything that tells you which one it is (“Home NAS”).
  2. Server: the DDNS name or the public address; Port: 3306.
  3. Encryption: Prefer (encrypted when the server offers it); Require or Verify when your server has TLS.
  4. The login: the user for SQL Wizard and its password. Test, then Save.
  5. Open it from the sidebar (Database server) and work as on any server: Monitor shows its name, version and memory.
It must answer on port 3306 and allow SQL Wizard’s address 91.234.46.58: those are the two most common reasons a Test fails.
Open in SQL Wizard

Security checklist for a server at home or in the office

A database reachable from the internet is looked for by robots all day. These keep it safe.

  • The firewall (NAS, Windows or the router) lets port 3306 in only from SQL Wizard’s address 91.234.46.58.
  • A user only for SQL Wizard, allowed only from SQL Wizard’s address 91.234.46.58, with a long password — never root, never '%'.
  • Only port 3306 forwarded: no DMZ, no “all ports”, no UPnP for everything.
  • Updates for the NAS, MariaDB and the router switched on.
  • Backups: ServerScheduled backups to another place (a second NAS, a storage box).
  • TLS on MariaDB for sensitive data: without it the data travels unencrypted.

Didn’t find it?

In SQL Wizard, Report a problem reaches us directly — or write to us.