Extracting data from the things network to database

Hi,
I am trying to connect to my database from TTN to be able to receive data with the MQTT protocol. I have tried everything I find on the forum sites but there is nothing that works or I can’t.
I need to know how I extract data from TTN and send the same to my database created with wampserver.

Thank you.

(Sorry for this google translate)

Here’s an example of a mosquitto-invocation for my app:
mosquitto_sub -h eu1.cloud.thethings.network -u particulatematter@ttn -P NNSXS.XXXX.YYYY -t “#” -v

The name of my application is “particulatematter”
The part after “-P” is the API key (obscured by XXXX.YYYY in the example). You can create this in the console, make sure you copy it straight away after generation, you cannot view the exact key later.

The key was configured with the following rights:

Simulated uplinks will also appear on the MQTT stream, but without gateway information.

v2 docs: https://www.thethingsnetwork.org/docs/applications/mqtt/index.html

v3 docs: Integrations with MQTT Clients | The Things Stack for LoRaWAN