mysqld.sock missing

Discussion in 'Server Operation' started by satimis, Nov 9, 2006.

  1. satimis

    satimis Member

    Hi folks,

    ubuntu-6.06.1-LAMP-server-amd64

    After running;
    $ sudo apt-get -install mysql-server mysql-client.

    mySQL did not start, complaining "mysqld.sock" missing.

    On googling I found following postings;
    http://ubuntuforums.org/showthread.php?t=111292
    http://ubuntuforums.org/showthread.php?t=140036

    $ cat /etc/mysql/my.cnf | grep .sock
    Code:
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    socket          = /var/run/mysqld/mysqld.sock
    socket          = /var/run/mysqld/mysqld.sock
    socket          = /var/run/mysqld/mysqld.sock
    
    It was there.

    $ sudo mysqld
    Code:
    Password:
    061109 15:41:52  InnoDB: Started; log sequence number 0 43655
    061109 15:41:52 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
    061109 15:41:52 [ERROR] Do you already have another mysqld server running on port: 3306 ?
    061109 15:41:52 [ERROR] Aborting
    
    061109 15:41:52  InnoDB: Starting shutdown...
    061109 15:41:54  InnoDB: Shutdown completed; log sequence number 0 43655
    061109 15:41:54 [Note] mysqld: Shutdown complete
    
    $ sudo netstat -tap | grep mysql
    Password:
    No printout.

    I can't figure out a solution. Please help. TIA


    B.R.
    satimis
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Why do you have the same line three times in your configuration? Remove two of them and try again.

    What's in /etc/mysql/debian.cnf?
     
  3. satimis

    satimis Member

    Hi falko,

    It was quite strange that my problem gone after reboot the PC. I did not touch anything. Now mySQL is running.

    $ sudo netstat -tap | grep mysql
    Code:
    tcp        0      0 localhost:mysql         *:*                     LISTEN     4
    086/mysqld         
    
    $ cat /etc/mysql/my.cnf
    Code:
    ....
    [client]
    port            = 3306
    socket          = /var/run/mysqld/mysqld.sock
    ....
    [mysqld_safe]
    socket          = /var/run/mysqld/mysqld.sock
    nice            = 0
    ....
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    language        = /usr/share/mysql/english
    skip-external-locking
    ....
    
    It is an empty file.


    Now I'm facing another problem on continue my test.

    $ sudo mysqladmin -u root password rootsql
    Code:
    Password:
    
    It went through without complaint

    $ sudo mysqladmin -u root -h localhost password rootsql
    Code:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    satimis@ubuntu:~$ sudo mysqladmin -u root -h localhost password rootsql
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    
    It complained, even using another password. Whether localhost is not allowed using password? Tks

    Furthermore to login as user

    $ mysql
    Code:
    ERROR 1045 (28000): Access denied for user 'satimis'@'localhost' (using password: NO)
    
    $ sudo mysql
    Password: rootsql
    Sorry, try again
    Password: satimis' password
    Code:
    ERROR 1045 (28000): Access denies for user 'root@localhost' (using password:NO)
    
    Failed to login

    Could you please shed me some light. TIA

    B.R.
    satimis
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Ok, you have
    Code:
    socket          = /var/run/mysqld/mysqld.sock
    in three different sections, this is ok.


    When you run
    Code:
    sudo mysqladmin -u root password rootsql
    you have already set a password for the user root on localhost, so there's no need to run
    Code:
    sudo mysqladmin -u root -h localhost password rootsql
    You're getting "Access denied" because you have set a password before, and to change it you must provide your current password. Have a look at
    Code:
    man mysqladmin
     
  5. sjau

    sjau Local Meanie Moderator

    do you have in your my.cnf config old_passwords = 1?

    I kinda had the same problems. I added the dotdeb debs for running php5 and php4 and there was a newer mysql server package... but that one had problems with old_passwords and "log_expire". It did not see those two as options... when I commented them then I had problems with the pwd...

    So if you added the dotdeb debs then I recommend:

    (1) Remove all of MySQL
    (2) Remove the dotdeb debs
    (3) run: apt-get update
    (4) install all of mysql again...

    I need the old password thingy for my confixx setup...
     
  6. satimis

    satimis Member

    Hi sjau,

    Yes.

    $ cat /etc/mysql/my.cnf | grep old_passwords
    Code:
    old_passwords   = 1
    Sorry I don't follow. IIRC I did not add "dotdeb debs" deliberately. What is "dotdeb debs"? Tks.


    It came to my notice that "I can't restart/force-reload mysql". I must reboot PC to get mysql started automatically.

    $ sudo /etc/init.d/mysql restart
    Code:
    Stopping MySQL database server: mysqld.
    Starting MySQL database server: mysqld.
    .
    .
    ...failed or took more than 6s.
            Please take a look at the syslog.
    /usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
    Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

    $ sudo /etc/init.d/mysql force-reload
    Code:
    Reloading MySQL database server: mysqld/usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
    Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
    $ ls /var/run//mysqld/ | grep mysqld.sock
    No printout.

    $ cat /etc/mysql/my.cnf | grep sock
    Code:
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    socket          = /var/run/mysqld/mysqld.sock
    socket          = /var/run/mysqld/mysqld.sock
    socket          = /var/run/mysqld/mysqld.sock
    They were there.

    Tks.


    B.R.
    satimis
     
  7. sjau

    sjau Local Meanie Moderator

    what is in your /etc/apt/sources.list file?
     
  8. satimis

    satimis Member

    Hi falko,

    Please refer to my reply to "sjau" on post #6. Tks.

    I'll come back to the rest of your suggestion after solving the above problem, missing "mysqld.sock".

    B.R.
    satimis
     
  9. satimis

    satimis Member

    $ cat /etc/apt/sources.list
    Code:
    # deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release amd64 (20060807.1)]/ dapper main restricted
    deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release amd64 (20060807.1)]/ dapper main restricted
    
    deb http://us.archive.ubuntu.com/ubuntu/ dapper main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ dapper main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://us.archive.ubuntu.com/ubuntu/ dapper-updates main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-updates main restricted
    
    ## Uncomment the following two lines to add software from the 'universe'
    ## repository.
    - snip -
    
    deb http://us.archive.ubuntu.com/ubuntu/ dapper universe
    deb-src http://us.archive.ubuntu.com/ubuntu/ dapper universe
    
    - snip -
    ## or updates from the Ubuntu security team.
    # deb http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
    # deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
    
    deb http://security.ubuntu.com/ubuntu dapper-security main restricted
    deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted
    # deb http://security.ubuntu.com/ubuntu dapper-security universe
    # deb-src http://security.ubuntu.com/ubuntu dapper-security universe
    
    # deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
    # deb-src http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
    
    Tks.

    B.R.
    satimis
     
  10. sjau

    sjau Local Meanie Moderator

    Oh, you use ubuntu... well forget what I said above :)
     
  11. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    ls -la /var/run/mysqld
    and
    Code:
    updatedb
    locate mysqld.sock
    ?
     
  12. satimis

    satimis Member

    Hi falko,

    After reboot the PC, mysql is running.

    $ ps -ef | egrep 'mysql|apache2|postfix'
    Code:
    root      4022     1  0 23:19 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
    mysql     4086  4022  0 23:19 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
    root      4087  4022  0 23:19 ?        00:00:00 logger -p daemon.err -t 
    mysqld_safe -i -t mysqld
    root      4254     1  0 23:20 ?        00:00:00 /usr/sbin/saslauthd -m /var/spool/postfix/var/run/saslauthd -a pam
    root      4255  4254  0 23:20 ?        00:00:00 /usr/sbin/saslauthd -m /var/spool/postfix/var/run/saslauthd -a pam
    root      4256  4254  0 23:20 ?        00:00:00 /usr/sbin/saslauthd -m /var/spool/postfix/var/run/saslauthd -a pam
    root      4257  4254  0 23:20 ?        00:00:00 /usr/sbin/saslauthd -m /var/spool/postfix/var/run/saslauthd -a pam
    root      4258  4254  0 23:20 ?        00:00:00 /usr/sbin/saslauthd -m /var/spool/postfix/var/run/saslauthd -a pam
    root      4430     1  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    www-data  4468  4430  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    www-data  4469  4430  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    www-data  4470  4430  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    www-data  4471  4430  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    www-data  4472  4430  0 23:20 ?        00:00:00 /usr/sbin/apache2 -k start -DSSL
    satimis   4817  4796  0 23:25 pts/2    00:00:00 grep -E mysql|apache2|postfix
    
    $ ls -ls /var/run/mysqld/
    Code:
    total 4
    4 -rw-rw---- 1 mysql mysql 5 2006-11-12 23:20 mysqld.pid
    0 srwxrwxrwx 1 mysql mysql 0 2006-11-12 23:20 mysqld.sock
    'mysqld.sock' in pink color.

    $ sudo updatedb
    Password:

    $ locate mysqld.sock
    Code:
    /var/run/mysqld/mysqld.sock
    
    B.R.
    satimis
     
  13. falko

    falko Super Moderator Howtoforge Staff

    Looks ok. Maybe it was just a hickup...
     
  14. satimis

    satimis Member

    Noted with tks.

    B.R.
    satimis
     

Share This Page