5

I'm try to install mysql-5.5.29 source code on ubuntu. Every time I restart or start the service, it tells me that MySQL Daemon failed to start..

shell>>service mysql.server start

Starting MySQL
... * The server quit without updating PID file (/usr/local/mysql/data/ytl-HP-Pavilion-          g4-Notebook-PC.pid).

shell>>less /usr/local/mysql/data/ytl-HP-Pavilion-g4-Notebook-PC.err


130106 12:20:27 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
130106 12:20:27 InnoDB: The InnoDB memory heap is disabled
130106 12:20:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130106 12:20:27 InnoDB: Compressed tables use zlib 1.2.7
130106 12:20:27 InnoDB: Using Linux native AIO
130106 12:20:27 InnoDB: Initializing buffer pool, size = 128.0M
130106 12:20:27 InnoDB: Completed initialization of buffer pool
130106 12:20:27 InnoDB: highest supported file format is Barracuda.
130106 12:20:27  InnoDB: Waiting for the background threads to start
130106 12:20:28 InnoDB: 1.1.8 started; log sequence number 1595675
130106 12:20:28 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130106 12:20:28 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
130106 12:20:28 [Note] Server socket created on IP: '0.0.0.0'.
130106 12:20:28 [ERROR] Can't start server : Bind on unix socket: Address already in use
130106 12:20:28 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql ?
130106 12:20:28 [ERROR] Aborting

130106 12:20:28  InnoDB: Starting shutdown...
130106 12:20:29  InnoDB: Shutdown completed; log sequence number 1595675
130106 12:20:29 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

130106 12:20:29 mysqld_safe mysqld from pid file /usr/local/mysql/data/ytl-HP-Pavilion-g4-Notebook-PC.pid ended

shell>>ps aux |grep mysql
root      4884  0.0  0.0   5832   836 pts/1    S+   12:27   0:00 grep --color=auto mysql

shell>ll /usr/local/mysql

drwxr-xr-x 13 root  mysql  4096  1月  5 14:54 ./
drwxr-xr-x 13 root  root   4096  1月  5 14:54 ../
drwxr-xr-x  2 root  mysql  4096  1月  5 14:54 bin/
-rw-r--r--  1 root  mysql 17987 12月 10 14:16 COPYING
drwxr-xr-x  5 mysql mysql  4096  1月  6 12:23 data/
drwxr-xr-x  2 root  mysql  4096  1月  5 14:54 docs/
drwxr-xr-x  3 root  mysql  4096  1月  5 14:54 include/
-rw-r--r--  1 root  mysql  7605 12月 10 14:16 INSTALL-BINARY
drwxr-xr-x  3 root  mysql  4096  1月  5 14:54 lib/
drwxr-xr-x  4 root  mysql  4096  1月  5 14:54 man/
drwxr-xr-x 10 root  mysql  4096  1月  5 14:54 mysql-test/
-rw-r--r--  1 root  mysql  2552 12月 10 14:16 README
drwxr-xr-x  2 root  mysql  4096  1月  5 14:54 scripts/
drwxr-xr-x 27 root  mysql  4096  1月  5 14:54 share/
drwxr-xr-x  4 root  mysql  4096  1月  5 14:54 sql-bench/
drwxr-xr-x  2 root  mysql  4096  1月  5 14:54 support-files/

when install mysql yesterday,I use:

cmake . -DCMAKE_INSTALL_PREFIX="/usr/local/mysql" \
-DMYSQL_UNIX_ADDR=/var/lib/mysql

but I found /var/lib/mysql is empty when i use:

shell>> ll /var/lib/mysql
drwxr-xr-x  2 root root 4096  1月  2 23:38 ./
drwxr-xr-x 65 root root 4096  1月  2 23:38 ../

it seems 3306 socket is not in use

shell>>netstat -na | grep LISTEN
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
unix  2      [ ACC ]     流        LISTENING     14474    @/tmp/.ICE-unix/1685
unix  2      [ ACC ]     流        LISTENING     14475    /tmp/.ICE-unix/1685
unix  2      [ ACC ]     流        LISTENING     14449    /tmp/ssh- KTntrIp1gXrU/agent.1685
unix  2      [ ACC ]     流        LISTENING     2030     /tmp/.X11-unix/X0
unix  2      [ ACC ]     流        LISTENING     14142    /tmp/.com.google.Chrome.faNSdW/SingletonSocket
unix  2      [ ACC ]     流        LISTENING     13570    /run/user/ytlreal/keyring-cuLMzX/ssh
unix  2      [ ACC ]     流        LISTENING     14533    /tmp/pulse-dTohrWydajmn/native
unix  2      [ ACC ]     流        LISTENING     13581    /run/user/ytlreal/keyring-cuLMzX/pkcs11
unix  2      [ ACC ]     流        LISTENING     13583    /run/user/ytlreal/keyring-cuLMzX/gpg
unix  2      [ ACC ]     流        LISTENING     18200    /var/run/cups/cups.sock
unix  2      [ ACC ]     流        LISTENING     11828    /run/user/ytlreal/keyring-cuLMzX/control
unix  2      [ ACC ]     流        LISTENING     8408     @/com/ubuntu/upstart
unix  2      [ ACC ]     流        LISTENING     7998     @/org/bluez/audio
unix  2      [ ACC ]     流        LISTENING     2029     @/tmp/.X11-unix/X0
unix  2      [ ACC ]     流        LISTENING     11869    @/tmp/dbus-oZvW58NsSp
unix  2      [ ACC ]     流        LISTENING     8081     /var/run/acpid.socket
unix  2      [ ACC ]     流        LISTENING     9896     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     流        LISTENING     14913    @/tmp/dbus-2gkvFVNb
unix  2      [ ACC ]     流        LISTENING     9933     /var/run/sdp
unix  2      [ ACC ]     流        LISTENING     14457    @/tmp/dbus-kTBAyCa0aq
unix  2      [ ACC ]     流        LISTENING     9209     /var/run/avahi-daemon/socket
unix  2      [ ACC ]     SEQPACKET  LISTENING     8445     /run/udev/control
Tim
  • 322
  • 1
  • 3
  • 14

2 Answers2

6

There is another software which is listening in port 3306. Try doing

netstat -na | grep LISTEN

then see if it's true. 3306 shouldn't be there. If you see something is listening on that port, you have to kill that before trying to start MySQL

Vahid Farahmand
  • 2,528
  • 2
  • 14
  • 20
  • thanks,3306 port is not listed in netstat -na | grep LISTEN – Tim Jan 06 '13 at 05:08
  • "Can't start server : Bind on unix socket: Address already in use" means another software is listening on that port. You have to double or triple check it. – Vahid Farahmand Jan 06 '13 at 05:13
  • I checked it again , and did not found the 3306 socket. I've posted the result. :{ – Tim Jan 06 '13 at 05:26
  • could you change MySQL port to something else from 3306, it's in my.cnf file in /etc, or it's in same folder if you are compiling from code. Change 3306 port to something like 1036, check if it starts. – Vahid Farahmand Jan 06 '13 at 05:29
  • 1
    hah,I solved it. -DMYSQL_UNIX_ADDR=/var/lib/mysql is wrong.I changed it to DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock – Tim Jan 15 '13 at 03:12
3

These are the key lines

130106 12:20:28 [ERROR] Can't start server : Bind on unix socket: Address already in use
130106 12:20:28 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql ?

Find which program is using /var/lib/mysql

lsof /var/lib/mysql

Kill it

kill -HUP `lsof -t /var/lib/mysql`

Try uninstalling it too.

Now Install again your newly installed server

Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187