Find the answer to your Linux question:
Results 1 to 3 of 3
Hi Friends, Thanks for your help uptil now. I've one serious problem, i don't know why but my MySQL server stops and then starts automatically. Can anybody help me by ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2002
    Location
    New Delhi
    Posts
    4

    MySQL Services Restart and Connection pointer


    Hi Friends,

    Thanks for your help uptil now.

    I've one serious problem, i don't know why but my MySQL server stops and then starts automatically. Can anybody help me by telling why this happens???

    How can I counter this problem in my program which interacts with MySQL. Does the connection pointer gets destroys (i.e. it equates with NULL). How can I check whether there is connection available at the stage when I'm doing
    mysql_query(conn, "query")

    One more thing friends,
    how many connections can MySQL handle simultaniousy

    ThanksBuddies.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    How do you mean the MySQL server stops and starts? Does the process actually die, or does it just temporarily hang?
    What do you mean when you're asking if the connection pointer gets destroyed? It seems by the wording of your question that you seem to think that the pointer itself gets set to NULL, which cannot happen, since the mysql routines don't know where it's stored. Maybe I misunderstood you.
    About checking for writability: I haven't done any actual C programming with MySQL, but there has to be a way to find out which file descriptor the connection structure uses. Then, when you have the file descriptor, poll it for reading and/or writing, whichever you want. See poll(2).
    I don't think MySQL has a hard coded maximum on connnections. It probably accepts new connections until it runs out of memory.

  3. #3
    Just Joined! Sykotik's Avatar
    Join Date
    Mar 2002
    Location
    Cape Town, South Africa
    Posts
    54

    Re: MySQL Services Restart and Connection pointer

    Quote Originally Posted by Kumar Saurabh
    How can I check whether there is connection available at the stage when I'm doing
    mysql_query(conn, "query")
    mysql_query() will return an error value. According to the MySQL docs, probably CR_SERVER_GONE_ERROR or CR_SERVER_LOST in your case. Obviously, you'll have to attempt reconnecting to the MySQL server. Although, seeing that you're still using your old connection pointer, you might even get a CR_UNKNOWN_ERROR. I really don't know. Rest assured it won't blindly return a zero (It shouldn't, at least)

    Quote Originally Posted by Kumar Saurabh
    One more thing friends,
    how many connections can MySQL handle simultaniousy
    That is a server value you can set by passing mysqld a parameter. (-O variable=value)
    In this case, variable would be max_connections. The default value is 100.

    Hope this helps.
    --Sykotik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •