Instalei o servidor MySQL 5.5 no Ubuntu 12.04.
Eu estou tentando iniciar o servidor MySQL em um arquivo de meia diferente. Por padrão, o MySQL é executado em /var/run/mysqld/mysqld.sock.
Estou tentando executar o mesmo servidor em /var/run/mysqld/mysqld1.sock.
Para isso, fiz as seguintes alterações:
- Alterações no /etc/mysql/my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld1.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld1.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
**socket = /var/run/mysqld/mysqld1.sock**
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
-
Também adicionei a seguinte linha ao /etc/apparmor.d/usr/sbin.mysqld
/var/run/mysqld/mysqld1.sock w,
/ var / run / mysqld / mysqld [1-9] .sock w,
-
Eu também alterei a propriedade do diretório / var / run / mysqld para o usuário mysql.
ls -lA / var / run / | grep mysqld
drwxrwxrwx 2 mysql mysql 40 Dec 31 17:24 mysqld
No entanto, quando tento iniciar o servidor MySQL, recebo o seguinte erro (como usuário root)
$ mysqld --user=mysql --verbose
121231 18:40:56 [Note] Plugin 'FEDERATED' is disabled.
121231 18:40:56 InnoDB: The InnoDB memory heap is disabled
121231 18:40:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121231 18:40:56 InnoDB: Compressed tables use zlib 1.2.3.4
121231 18:40:56 InnoDB: Initializing buffer pool, size = 128.0M
121231 18:40:56 InnoDB: Completed initialization of buffer pool
121231 18:40:56 InnoDB: highest supported file format is Barracuda.
121231 18:40:57 InnoDB: Waiting for the background threads to start
121231 18:40:58 InnoDB: 1.1.8 started; log sequence number 1595685
121231 18:40:58 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
121231 18:40:58 [Note] - '127.0.0.1' resolves to '127.0.0.1';
121231 18:40:58 [Note] Server socket created on IP: '127.0.0.1'.
**'121231 18:40:58 [ERROR] Can't start server : Bind on unix socket: Permission denied'**
121231 18:40:58 [ERROR] Do you already have another mysqld server running on socket:
/var/run/mysqld/mysqld1.sock ?
121231 18:40:58 [ERROR] Aborting**
121231 18:40:58 InnoDB: Starting shutdown...
121231 18:40:58 InnoDB: Shutdown completed; log sequence number 1595685
121231 18:40:58 [Note] mysqld: Shutdown complete
Se eu iniciar o servidor com o arquivo de soquete padrão, posso iniciar o servidor. Eu pesquisei sobre esse problema, mas só encontrei soluções sugerindo que fosse um problema de permissão. No entanto, as permissões parecem bem. Alguns sugeriram que o AppArmor pode ser uma causa, mas verifiquei também - o snippet está colado acima.
Alguém pode fornecer algumas dicas?
[EDITAR]
Eu vejo a seguinte saída em /var/log/syslog
.
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 [Note] Plugin 'FEDERATED' is disabled.
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: The InnoDB memory heap is disabled
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: Compressed tables use zlib 1.2.3.4
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: Initializing buffer pool, size = 128.0M
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: Completed initialization of buffer pool
Jan 2 12:09:34 praveshp-lt mysqld: 130102 12:09:34 InnoDB: highest supported file format is Barracuda.
Jan 2 12:09:35 praveshp-lt mysqld: 130102 12:09:35 InnoDB: Waiting for the background threads to start
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 InnoDB: 1.1.8 started; log sequence number 1595685
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3307
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [Note] - '127.0.0.1' resolves to '127.0.0.1';
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [Note] Server socket created on IP: '127.0.0.1'.
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [ERROR] Can't start server : Bind on unix socket: Permission denied
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld1.sock ?
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [ERROR] Aborting
Jan 2 12:09:36 praveshp-lt mysqld:
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 InnoDB: Starting shutdown...
Jan 2 12:09:36 praveshp-lt kernel: [ 7060.098580] type=1400 audit(1357108776.036:33): apparmor="DENIED" operation="mknod" parent=6702 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld1.sock" pid=7039 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=116 ouid=116
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 InnoDB: Shutdown completed; log sequence number 1595685
Jan 2 12:09:36 praveshp-lt mysqld: 130102 12:09:36 [Note] /usr/sbin/mysqld: Shutdown complete
Diz permissão negada, mas parece que eu defini as permissões certas.