Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql service does not start:Address already in use [closed]

Tags:

mysql

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
like image 756
Tim Avatar asked Jan 06 '13 04:01

Tim


People also ask

How to fix MySQL service will not start on Windows 10?

Re: MySQL Service will not start on Windows 10 - Solved! I finally solved this after more digging on my own. These are the steps I took: 1. Took out the # in front of the host file for 2. Added the text below to the my.ini file just below the [mysqld] 3. Restart MYSql80 service (or reboot your computer) 4.

Why is mysqld unable to start my server?

If either of the following errors occur, it means that some other program (perhaps another mysqld server) is using the TCP/IP port or Unix socket file that mysqld is trying to use: Can't start server: Bind on TCP/IP port: Address already in use Can't start server: Bind on unix socket...

Why can’t I run MySQL on my port?

MySQL port already in use – If some other process is running in the MySQL port (default 3306), MySQL would be unable to bind to the port and cannot run. Unable to write to /tmp – If the /tmp directory is not writable due to permission issues or lack of space, MYSQL cannot write the needed files and cannot start.

How to prevent MySQL from starting automatically on startup?

This application that already listens on por 3306 is another instance of MySQL that's probably configured to start automatically. If you are using Windows, click the Start button, then Execute, then type services.msc and press [Enter]. Look for the running MySQL service, stop it, and configure it to prevent its launching on system startup.


Video Answer


2 Answers

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

like image 76
Vahid Farahmand Avatar answered Nov 15 '22 08:11

Vahid Farahmand


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

like image 41
Shiplu Mokaddim Avatar answered Nov 15 '22 10:11

Shiplu Mokaddim