MySQL-error : can't connect to local mysql server through socket

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pugi!

    MySQL-error : can't connect to local mysql server through socket

    On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get
    the following problem when connecting to mysql through a browser
    (phpMyAdmin):
    :
    #2002 Can't connect to local MySQL server through socket
    /var/lib/mysql/mysql.sock

    On the website of MySQL this error is mentioned but I found no solution.

    In /var/log/messages the following log occurs :
    localhost kernel: audit(....): avc: denied {write}for pid=2458
    exe=/usr/sbin/httpd name=mysql.sock dev=hda13 ...

    What I have tried :
    - mysql.sock is srwxrwxrwx, seems ok, but dont know what the s stands for
    - the dir /var/lib/mysql was drwxr-xr-x and I changed it to drwxrwxrwx : no
    effect
    - tried different version of phpMyAdmin : same error
    - installed my website and got the following error : No connection possible
    with database (in the next version I will improve the error-messages)
    - through commandline there is no problem in connecting to mysql (log in,
    create databases, inserts, deletes, uploading dumps, making dumps, ....)

    What is the solution or what else can I try ?

    thanx,

    Pugi!



  • J.O. Aho

    #2
    Re: MySQL-error : can't connect to local mysql server through socket

    Pugi! wrote:[color=blue]
    > On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get
    > the following problem when connecting to mysql through a browser
    > (phpMyAdmin):
    > :
    > #2002 Can't connect to local MySQL server through socket
    > /var/lib/mysql/mysql.sock[/color]

    This kind of messages are common when people haven't started the mysql server.

    chkconfig --level 35 mysqld on
    /etc/init.d/mysqld start


    //Aho

    Comment

    • Pugi!

      #3
      Re: MySQL-error : can't connect to local mysql server through socket

      The correct answer was : adjust settings SELinux for httpd/apache.


      "J.O. Aho" <user@example.n et> schreef in bericht
      news:3034mnF2q4 jc8U1@uni-berlin.de...[color=blue]
      > Pugi! wrote:[color=green]
      >> On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get
      >> the following problem when connecting to mysql through a browser
      >> (phpMyAdmin):
      >> :
      >> #2002 Can't connect to local MySQL server through socket
      >> /var/lib/mysql/mysql.sock[/color]
      >
      > This kind of messages are common when people haven't started the mysql
      > server.
      >
      > chkconfig --level 35 mysqld on
      > /etc/init.d/mysqld start
      >
      >
      > //Aho[/color]


      Comment

      • Richard Hollenbeck

        #4
        Re: MySQL-error : can't connect to local mysql server through socket

        Pugi! wrote:
        [color=blue]
        > The correct answer was : adjust settings SELinux for httpd/apache.[/color]

        How would that editing be done? I'm getting similar errors:

        rich@linux:~> mysql -u root --host=localhost;
        ERROR 2002: Can't connect to local MySQL server through socket
        '/var/lib/mysql/mysql.sock' (2)
        rich@linux:~> mysql -u root --host=localhost
        ERROR 2002: Can't connect to local MySQL server through socket
        '/var/lib/mysql/mysql.sock' (2)
        rich@linux:~> mysql -u root -h localhost;
        ERROR 2002: Can't connect to local MySQL server through socket
        '/var/lib/mysql/mysql.sock' (2)
        rich@linux:~> mysql -uroot -hlocalhost;
        ERROR 2002: Can't connect to local MySQL server through socket
        '/var/lib/mysql/mysql.sock' (2)
        rich@linux:~> mysql -uroot --host="localhost "
        ERROR 2002: Can't connect to local MySQL server through socket
        '/var/lib/mysql/mysql.sock' (2)
        rich@linux:~>

        I should have no password yet since this is a brand new installation of
        Linux with Apache, MySQL, and PHP. The '/var/lib/mysql/' directory is
        empty. But if I put -p password I get prompted for a password, which is
        always wrong and sends me back to the command line.


        Comment

        Working...