Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 696075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:01:32+00:00 2026-05-14T03:01:32+00:00

I am looking for the MySQL equivalent of CONTEXT_INFO that is present in SQL

  • 0

I am looking for the MySQL equivalent of CONTEXT_INFO that is present in SQL Server. Or any other session variable like thing using which I can pass the username to the trigger.

I am currently working on logging table data for audit. I need to pass the username of the logged in user to the delete trigger.

Any ideas? We are deleting the rows from the table in a few cases and marking them as deleted in others.

Any alternate solutions are welcome. I thought of using AOP but it could prove problematic when deleting a cascade. I want to look into Hibernate Interceptors, not sure at this point if that works.

If I can find the MySQL equivalent of CONTEXT_INFO, my job is done and elegant as well.

Thanks,

Julia.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:01:33+00:00Added an answer on May 14, 2026 at 3:01 am

    You should be able to get the current user with the USER() function. See the doc for details.


    Ok, I didn’t quite understand what you were asking. I think you may want to take a look at MySQL’s support for connection-level user variables. Basically, in the connection that will run the UPDATE / INSERT / DELETE but before the actual query runs you need to run a set statement SET @user = 'my_user_id'. Then you should be able to use @user as the user in your trigger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for few global variable in mysql which are equivalent of sql
So, looking for a mysql-db-lib that is compatible with py3k/py3.0/py3000, any ideas? Google turned
Using MySQL, i'm selecting a list of songs in spanish that i would like
I have MySQL tables looking like that regions table id | region ------------------- 1
I'm looking for a MySQL equivalent of what str_replace is for PHP. I want
Looking for a good tutorial on how to update a mysql database using a
I am looking to parse INSERT and UPDATE MySQL SQL queries in PHP to
Looking for a tool that will automatically create a graphical representation of a MySQL
Does MySQL have any equivalent feature to Oracle's virtual private databases in 10g. It
Is there an equivalent of MySQLs on update field for SQL server? With both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.