Professional Web Applications Themes

Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock' - PERL Modules

Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock' I got this trying to install DBI and DBD for mysql from CPAN. After fumbling, a comment by somebody said "Make /tmp world writable and set the sticky bit" OK so chmod uog+t /tmp (and I did +rwx too - was that wrong?) but no dice, so knowing that mysql has set up its socket in /var/lib/mysql/mysql.sock and finding no obvious way to change this default, I used a soft link in /tmp ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock and now everything works right. But, have I compromised file permissions ...

  1. #1

    Default Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock'

    Seen this message? Can't connect to local MySQL server through socket
    '/tmp/mysql.sock'

    I got this trying to install DBI and DBD for mysql from CPAN. After
    fumbling, a comment by somebody said "Make /tmp world writable and set
    the sticky bit"

    OK
    so

    chmod uog+t /tmp (and I did +rwx too - was that wrong?)

    but no dice, so knowing that mysql has set up its socket in
    /var/lib/mysql/mysql.sock and finding no obvious way to change this
    default, I used a soft link

    in /tmp

    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

    and now everything works right. But, have I compromised file
    permissions unnecessarily, or, is there a way to just use
    /var/lib/mysql/mysql.sock without this fussing?

    Thanks!
    Allen Marshall Guest

  2. #2

    Default Re: Seen this message? Can't connect to local MySQL server throughsocket '/tmp/mysql.sock'

    Allen Marshall wrote:
    > Seen this message? Can't connect to local MySQL server through socket
    > '/tmp/mysql.sock'
    >
    > I got this trying to install DBI and DBD for mysql from CPAN. After
    > fumbling, a comment by somebody said "Make /tmp world writable and set
    > the sticky bit"
    >
    > OK
    > so
    >
    > chmod uog+t /tmp (and I did +rwx too - was that wrong?)
    >
    > but no dice, so knowing that mysql has set up its socket in
    > /var/lib/mysql/mysql.sock and finding no obvious way to change this
    > default, I used a soft link
    >
    > in /tmp
    >
    > ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
    >
    > and now everything works right. But, have I compromised file
    > permissions unnecessarily, or, is there a way to just use
    > /var/lib/mysql/mysql.sock without this fussing?
    >
    > Thanks!
    Yes, You can specify an option to use a particular socket file in your
    DSN when establishing your connection in perl. FYI when you get around
    to configuring your PHP install you'll need to look up that option too.
    I've used it before but don't remember the syntax off hand.

    This is courtesy of a google search on |DBI Mysql sock file|

    my $dbh = DBI->connect("DATABASE;mysql_socket=/PATH/TO/SOCKET", "user",
    "pass", "mysql");

    Although the order presented here looks wrong, I'd try this, then put
    the ";mysql_socket=" at the end with your actual path following it.

    Dan Guest

Similar Threads

  1. Where should I put the mysql.sock ?
    By howachen@gmail.com in forum MySQL
    Replies: 2
    Last Post: August 18th, 04:30 PM
  2. Replies: 3
    Last Post: March 29th, 02:45 AM
  3. Replies: 0
    Last Post: January 29th, 02:03 PM
  4. Connect to MySQL using local testing server on OS X
    By Steve Lawrie in forum Dreamweaver AppDev
    Replies: 4
    Last Post: March 26th, 08:31 PM
  5. Replies: 0
    Last Post: January 24th, 10:55 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139