5

我正在尝试在 ubuntu 上安装 mysql-5.5.29 源代码。每次我重新启动或启动服务时,它都会告诉我 MySQL Daemon 无法启动..

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/

昨天安装mysql时,我使用:

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

但是我发现 /var/lib/mysql 在我使用时是空的:

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 ../

似乎 3306 套接字未在使用中

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
4

2 回答 2

5

还有另一个软件正在侦听端口 3306。尝试做

网络统计-na | grep 听

然后看看是不是真的。3306 不应该在那里。如果你看到有东西在那个端口上监听,你必须在尝试启动 MySQL 之前杀死它

于 2013-01-06T04:59:50.040 回答
3

这些是关键线

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 ?

查找正在使用的程序/var/lib/mysql

lsof /var/lib/mysql

杀了它

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

也尝试卸载它。

现在再次安装新安装的服务器

于 2013-01-06T05:29:40.030 回答