Create MySQL service - plugin

I want to create a plugin that takes data from my MySQL server and deliver it on the local network.
and then it must scherch the local network for devices with a specific OUI’s and sending them with the IP adress to the DB.

But i have no idear to ger started og to create the plugin.

i know some web development.

Your request does not make much sense. What you are describing sounds like a MySQL client which queries a MySQL database, but such a client runs on a device connected to the router, not on the router itself. Furthermore, what is the meaning of “deliver it on the local network” and “OUI’s”. Why would you want to save ip adresses of connected devices in a database?

The Plugin is surpose to tjeck a DB to se if there is a printer job, and then send it to the local printer.
and it must search the local network for OUI’s of the printer, so i can add more printers, and it will be saved in the DB.

You are trying to build a print server? If you connect a printer or printers to the router network port, all client computers will be able to discover the printer(s) and send print jobs, so no need for a plugin. Or connect a printer to the usb port of the router and start the printer server on the router: How to set up a USB printer (Windows, RUTX11) - Teltonika Networks Wiki

Good afternoon,

I can see that other forum members have kindly assisted you. Please advise if at current time you need any further assistance.

Regards,
Arturas

No not a printer server.

It is going to be able to print, but it is not an normal printer.

And I have another use for it.
And to need to be able to add more devices no mattere where I am.

And I need a webpage ne’er the device.

So how do I make a plugin that do what I need?

Hi there,

  1. Set Up MySQL for Network Access

Ensure your MySQL server is configured to accept connections from other devices on the local network by editing the MySQL config file (e.g., /etc/mysql/mysql.conf.d/mysqld.cnf) and setting bind-address = 0.0.0.0 to listen on all interfaces.
Create a MySQL user with privileges to connect from your client device IPs and access the necessary database/tables.
Open port 3306 on your server firewall/router to allow MySQL traffic within your LAN.

  1. Develop the Plugin Logic

Database Interaction: Use a programming language you know (e.g., Python, Node.js, PHP) with MySQL client libraries to connect to the MySQL server over the local network, query for print jobs, and update device info.
Network Scanning: Implement a network scanner to detect devices on the local subnet. You can:
Use ARP scanning or ping sweeps to find active IPs.
Retrieve MAC addresses from ARP tables or by sending network probes.
Extract OUIs from MAC addresses to identify device manufacturers.
Update Database: For each detected device matching your target OUIs (e.g., printers), insert or update their IP and OUI info in your MySQL database.

  1. Web Interface Near the Device

Develop a lightweight web server (e.g., using Flask for Python, Express for Node.js) running on the same device as the plugin.
This web interface can display current devices, allow manual addition/removal, and show print job status.
Access the web interface via the device’s IP address on the local network.

  1. Remote Access and Adding Devices Anywhere

To manage devices remotely, consider:
Using secure tunnels or VPNs to access your local network.
Tools like LocalXpose can expose your local MySQL or web server securely over the internet.
Implement authentication and encryption to protect your database and web interface.

  1. Development Workflow

Start by writing a simple script that connects to your MySQL server over the LAN and runs basic queries.
Add network scanning functionality to detect devices and extract OUIs.
Integrate the scanning results with database updates.
Build the web interface for local management.
Test the entire setup on your local network.
Finally, add remote access capabilities if needed.

Summary

You are essentially building a custom client-server application that:

Connects to a MySQL database over the local network.
Scans the network for devices by OUI.
Updates the database with device IPs.
Provides a local web interface for management.
Optionally supports remote access via tunneling or VPN.

This approach leverages your web development skills and standard networking/database tools. You will need to learn some network scanning techniques and database connectivity programming, but plenty of tutorials exist for these topics.

Regardsm
Arturas