Thread: MYSQL_UNIX_PORT

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Marlboro, NJ USA
    Posts
    4
    Rep Power
    0
    I am having prblem where every night the /tmp/mysql.socket is deleted. I am not sure how..can't find a crontab that is deleting /tmp dir. But any way read mysql docs on how to fix and they say...

    "start safe_mysqld with the --socket=/path/to/socket option and set the environment variable MYSQL_UNIX_PORT to the socket pathname before starting your MySQL clients"

    the starting safe_mysqld part i GET.

    But WHERE can I find and set the environment variable MYSQL_UNIX_PORT ?????

    I do not see a my.conf file any where!
    Please help..its a pain in the *** staying up till 2am restarting server every night!
    Thanks
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    What operating system are you using?

    Generally in a Unix operating system, you can simply run a startup script (or add lines to an existing startup script) that sets the variable; something like this:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>#/usr/bin/bash

    MYSQL_UNIX_PORT = "/path/to/socket"
    export MYSQL_UNIX_PORT

    # then start mysql here
    safe_mysqld --socket=/path/to/socket
    [/code]

    Depending on your shell, the syntax may vary, but you get the idea. you also have to make sure the MYSQL_UNIX_PORT variable is set BEFORE safe_mysqld is executed.

    [This message has been edited by rycamor (edited July 29, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Marlboro, NJ USA
    Posts
    4
    Rep Power
    0
    Thanks for the response. I got a similiar response elsewhere and attempted exactly what you suggested. BUT it is REALLY weird!
    First I do this
    #/usr/bin/bashMYSQL_UNIX_PORT = "/path/to/socket"export MYSQL_UNIX_PORT# then start mysql heresafe_mysqld --socket=/path/to/socket

    after mysqld is running I use mysqladmin to find out where the socket is and it reports back /tmp2 (the directory I created for it)

    BUT from the browser when trying to insert info or run a query it comes up with the SAME error can not connect to mysql.sock in /tmp/mysql.sock !
    It is as though the envronment variable change NEVER took place!

    Any ideas on that one?
    I am running
    FreeBSD 3.4-STABLE
    Apache/1.3.12
    mysqld Ver 3.22.27
    THANKS

  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    Fortunately, FreeBSD happens to be the OS I am most familiar with. I have spent countless hours with Apache, MySQL, PHP, etc...

    I notice you mention a browser, but you don't mention what server-side method you use to connect to MySQL. Is it PHP, Perl, JSP? When you say "It is as though the envronment variable change NEVER took place" it makes me think: maybe you should check the owner of the script, and the username of the server-side scripting language (nobody:nobody?). Environment variables can be different for different users.

    Also, I would recommend you get the last stable version of MySQL, which is 3.22.32
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Marlboro, NJ USA
    Posts
    4
    Rep Power
    0
    rycamor,
    Thanks again for taking your time out here to help. I am using php3 as a scriptiong language....but I am unsure as how to tell who the owner of that is.

    I'll try the upgrade to the latest version oh Mysql and see if that does anything.
    Regards
  10. #6
  11. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    Generally, the PHP process runs under the username 'nobody', and group 'nobody'.

    Try to chown your mysql startup script:

    chown nobody:nobody mysql_start_script.sh

    However, I really think something isn't quite right here: I have used exactly the same combination of server software on many installs and it has worked perfectly well without worrying about the mysql temp socket. Maybe you have some data corruption occurring on your hard drive, or something.

    If I were you, I would start clean: test your hardware, and reinstall FreeBSD, then MySQL, Apache, PHP, etc... While you're at it, may as well install PHP4.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Marlboro, NJ USA
    Posts
    4
    Rep Power
    0
    Well...as mush as I hate to say it...That seems like the best solution. Might as well upgrade server a littel while I am at it!
    Thanks for your help again! And i'll let you know how I make out.
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    If you want to stop this deleting from tmp put sticky bit on /tmp dir with chmod +t /tmp. This will protect your file from beeing deleter from some other than mysql.


IMN logo majestic logo threadwatch logo seochat tools logo