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

    Join Date
    Feb 2003
    Posts
    2
    Rep Power
    0

    Angry Can't connect to mysql


    I installed mysql and a groupware tool. Everything went fine until I tried to change some permissions to the database...

    My problem:

    The Groupware Tool is up and running fine - it's ok
    But I can't connect to mysql with another user or with the mysqladmin...

    Error message:
    [root@localhost mysql]# mysql
    ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
    [root@localhost mysql]#

    Mysql is running:
    [root@localhost mysql]# ps -ef | grep mysql
    root 941 1 0 Feb20 ? 00:00:00 /bin/sh /usr/bin/safe_mysqld --d
    mysql 7391 941 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f
    mysql 7393 7391 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f
    mysql 7394 7393 0 Feb21 ? 00:00:01 /usr/libexec/mysqld --defaults-f
    mysql 7395 7393 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f
    root 17415 16950 0 17:12 pts/0 00:00:00 grep mysql

    and the .sock file exists:

    [root@localhost mysql]# ls -l /var/lib/mysql/mysql.sock
    -rwxrwxrwx 1 mysql mysql 0 Feb 27 16:34 /var/lib/mysql/mysql.sock
    [root@localhost mysql]#

    has someone an idea how I can fix that?

    Thanks...
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    1
    Rep Power
    0
    I've just spent a week going over every part of my RH Linux 7.0/PHP 4.x/mySQL 3.x/Apache 3.x install for this same problem. Tried lots of solutions proposed here and in other forums.

    Perhaps the solution that worked for me might help here as well.
    ____________

    Everything was fine in mySQL - all tools and functions - when I was logged onto the Linux host as 'root' (or with 'su'). Nothing worked as any other user.

    Permissions. Permissions. Permissions.

    I checked every file in both mySQL and PHP installs, and couldn't find a problem with rights.

    It turns out that only root had any permissions on the /var/lib/mysql/ directory where the mysql.sock file lives in my installation. It looked like this: -rwx------ so I chmod'd it to look like this: -rwxrwxrwx (prob went too far!)

    Now I can access mySQL data and admin as any authorized user and from my PHP scripts as well. I'm very happy now.

    I hope this saves someone else a week of digging.

    Best of luck,

    Brian
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    2
    Rep Power
    0

    Unhappy


    Hi Brian,

    thanks for your answer, but it didn't help...

    [root@localhost lib]# ls -al
    drwxrwxrwx 5 mysql mysql 4096 Feb 27 16:34 mysql

    If I try to connect via PHPmyAdmin I get the message

    Server localhost
    Error

    MySQL said:


    MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

    Maybe I have to explain how this situation was coming up...

    I had the whole installation working with localhost permissons for access to mysql. I tried to change this via Webmin that I can access the DB from a Gui outside this host. I think I took all permissions from the super user (Don't know how).

    Is it possible to rebuild the user table? Without affect to the running Groupware?

    Regards
    Frank
    Last edited by pacman; February 28th, 2003 at 01:50 AM.

IMN logo majestic logo threadwatch logo seochat tools logo