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

  • SEARCH
  • Home
  • 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 8891007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:37:50+00:00 2026-06-14T22:37:50+00:00

Is it possible to determine (through a query or some other means) if someone

  • 0

Is it possible to determine (through a query or some other means) if someone is already using a specific MySQL database before a new connection attempt to it is made? I have a database where I would like to restrict the number of users to one at a time. (even one instance of each user, not necessarily two different users at once)

My reason for this is to prevent any read/write conflicts between multiple instances of a program that works with this database. Due to the way the program works, if changes are made in Instance A they would not immediately show up in Instance B until the data gets refreshed. Right now there is no way to sync these in real time. It would just be easier to prevent Instance B from starting until Instance A is finished) In my situation, both the client app and database run on localhost but it is possible for the database to be remote.

Can this be done? If so, is there an easy way to do it through Qt?

  • 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-06-14T22:37:51+00:00Added an answer on June 14, 2026 at 10:37 pm

    As of MySQL 5.0.3, you can limit the number of simultaneous connections to the server by an account. You can then detect if the account is in use because additional connection attempts will be refused by the server (either with error 1203 ER_TOO_MANY_USER_CONNECTIONS or error 1226 ER_USER_LIMIT_REACHED).

    GRANT USAGE ON *.* TO 'usera'@'localhost' WITH MAX_USER_CONNECTIONS 1
    

    More about resource limits:

    • To set resource limits for an account, use a GRANT statement. Provide a WITH clause that names each resource to be limited. MAX_USER_CONNECTIONS is an integer representing the maximum number of simultaneous connections by the account.

    • To modify or remove limits for an account, use a GRANT USAGE statement at the global level (GRANT USAGE ON *.* TO 'usera'@'localhost' WITH ...). This modifies only the limit value(s) specified and leaves the account otherwise unchanged.

    • An “account” corresponds to a single row in the mysql.user table. 'usera'@'localhost' and 'usera'@'%.example.com' are distinct accounts.

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

Sidebar

Related Questions

while using database under MySQL how can i determine my current MySQL version,database name
Is it possible to determine if a given SID is User or Group using
Is it possible to determine a specific file's fragmentation status (that is, the amount
Is it possible to determine an object type's alias(es) through reflection? Given the following
I'm working with some images from the Flickr API using jQuery, and looping through
I know that it's possible to determine the data connection type (WIFI/or cellular) through
Possible Duplicate: Determine original name of variable after its passed to a function. I
Is it possible to determine the byte size of a scipy.sparse matrix? In NumPy
Is it possible to determine if an EasyMock mock is on replay mode? Something
Is it possible to determine which property of an ActiveX control is the default

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.