# Identify user by proxysql host

**URL:** <https://forums.percona.com/t/identify-user-by-proxysql-host/13123>\
**Category:** ProxySQL\
**Tags:** mysql, percona\
**Created:** [November 19, 2021, 4:26pm UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123 "2021-11-19T16:26:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafaelcl14](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rafaelcl14/32/5132_2.png) [@rafaelcl14](https://forums.percona.com/u/rafaelcl14)\
**Post date:** [November 19, 2021, 4:26pm UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123/1 "2021-11-19T16:26:18Z")

</div>

Good morning how are you?  
We are testing ProxySQL and we are at an impasse.  
We have several users with their names repeated, differing only by the origin host, we would like that when a user accesses the database and goes through proxysql, the proxysql makes the balance and informs the database the user’s origin host.

In the test, proxysql reports only the proxysql host itself, ignoring the user’s source host.

Is there a way this can be done?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 21, 2021, 1:44am UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123/2 "2021-11-21T01:44:07Z")

</div>

> [@rafaelcl14](#):
>
> In the test, proxysql reports only the proxysql host itself, ignoring the user’s source host.

Correct. There is no workaround for this as it is not a bug. Applications make connections to ProxySQL believing it is MySQL. ProxySQL makes separate, independent connections, acting as a client, to backend MySQL servers.

---

<div class="post-metadata">

**Author:** ![rafaelcl14](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rafaelcl14/32/5132_2.png) [@rafaelcl14](https://forums.percona.com/u/rafaelcl14)\
**Post date:** [November 23, 2021, 7:56pm UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123/3 "2021-11-23T19:56:51Z")

</div>

Hi thanks for the help.

I’m in doubt about how the Audit would be done using Percona’s ProxySQL?  
Example: How to know that a specific user, at a given time (Date/Time), made a writing or reading command to the database? since in the mysql database you will see that the proxysql user will be doing both writing and reading commands.

---

<div class="post-metadata">

**Author:** ![rafaelcl14](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rafaelcl14/32/5132_2.png) [@rafaelcl14](https://forums.percona.com/u/rafaelcl14)\
**Post date:** [November 23, 2021, 8:22pm UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123/4 "2021-11-23T20:22:51Z")

</div>

Because I would like to identify or audit what users do to the database, as each user machine has a fresh installation connected to the database, how can we do this with the proxy? To some monitoring that I can at least identify the host of origin of the command?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 24, 2021, 4:05am UTC](https://forums.percona.com/t/identify-user-by-proxysql-host/13123/5 "2021-11-24T04:05:01Z")

</div>

> [@rafaelcl14](#):
>
> you will see that the proxysql user will be doing both writing and reading commands

That is incorrect. There is no “proxysql user”. ProxySQL will use the same username/password that your application uses to establish back-end connections. This is why the `mysql_users` table in proxysql’s config exists. You must add all application accounts to proxysql for this purpose. Your audit logs will still show username/date/time, but the source IP will always be proxysql.
