It may be worth going over the relevant mysql documentation again. https://dev.mysql.com/doc/refman/8.4/en/insert-on-duplicate.html Have fun On 2025/07/12 15:58, Rodrigo Prazim wrote:
Hi, Matthew.
Correction:
In radiusd -X
The console displayed the query error:
(0) Executing select query: "INSERT INTO radius.radcircuitid (username, circuitid) VALUES ('teste@allohaligue', 'HelloWorld') ON DUPLICATE KEY UPDATE circuitid = 'HelloWorld'" (0) ERROR: rlm_sql_mysql: ERROR 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"INSERT INTO radius.radcircuitid (username, circuitid) VALUES ('teste@allohaligu' at line 1): 42000 (0) ERROR: SQL query failed: server error
Then I made the correction to:
"%{sql:INSERT INTO...}"
And no erro appeared:
(0) Executing query: INSERT INTO radcircuitid (username, circuitid) VALUES ('teste@allohaligue', 'OlaMundo112') ON DUPLICATE KEY UPDATE circuitid = 'HelloWorld' rlm_sql (sql): Released connection (6)
Even though it worked, I would like to know if it is the best way out.
... Rodrigo Prazim
________________________________ De: Freeradius-Users<freeradius-users-bounces+rodrigoprazim=hotmail.com@lists.freeradius.org> em nome de Matthew Newton via Freeradius-Users<freeradius-users@lists.freeradius.org> Enviadas: Sábado, 12 de Julho de 2025 10:43 Para:freeradius-users@lists.freeradius.org <freeradius-users@lists.freeradius.org> Cc: Matthew Newton<mcn@freeradius.org> Assunto: Re: New custom query - MySQL
On 12/07/2025 14:41, Rodrigo Prazim wrote:
I'm using the radclient for test: echo "User-Name='teste@allohaligue',User-Password=testeligue,ADSL-Agent-Circuit-Id=HelloWorld" | radclient localhost:1812 auth testing123 But nothing arrives in the database: I guess nothing arrives in the FreeRADIUS debug output, either.
-- Matthew
- List info/subscribe/unsubscribe? Seehttps://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.freeradius.org%2Flist%2Fusers.html&data=05%7C02%7C%7C7efbe347a26c484954b308ddc14a2f6a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638879246557523792%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eIXX8dxg83zZKjwlBATgzJs4EhMnUgvsbndxQeDi2ac%3D&reserved=0<http://www.freeradius.org/list/users.html> - List info/subscribe/unsubscribe? Seehttp://www.freeradius.org/list/users.html