I need to select the OS user during trigger execution to insert into a table. How can I select the OS User as it may be different from the MySQL user?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Some RDBMS (SQL Server) allow you to get this information easily. Especially for a direct DB connection from code running in the user's session on Windows, using Windows Auth to connect to SQL Server.
It can be done if the user connects to a website, which then connects to SQL Server too.
However, you're on MySQL.
Your simplest option is to have the client code send it in, derived from the OS. Ypu can then pass this in to the trigger as per this SO answer http://stackoverflow.com/questions/324605/mysql-trigger-storing-a-select-in-a-variable