gpt4 book ai didi

Mysql 5.7 无法创建 unix socket 锁定文件

转载 作者:行者123 更新时间:2023-12-02 11:21:51 27 4
gpt4 key购买 nike

我正在尝试在同一个 Ubuntu 16.10 32 位框中创建 MySQL 5.7 的多个实例。我已将原始数据目录复制到新目录。为新实例创建了单独的日志文件夹(日志正在运行)。将新数据目录/var/lib/mysql2 和日志目录/var/log/mysql2/的所有者更改为 mysql:mysql。我已经删除了应用程序装甲。我只有在通过其他 SO 答案之后才发布了这个问题......其中没有一个解决多实例问题。

这是我的 my2.cnf:

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld2.pid
socket = /var/run/mysqld/mysqld2.sock
port = 3307
basedir = /usr
datadir = /var/lib/mysql2
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M

[mysqld_safe]
socket = /var/run/mysqld/mysqld2.sock
nice = 0

如您所见,我已将端口分别更改为 3307 和其他端口。现在当我运行时(必须将 sudo 添加到 mysqld):
sudo mysqld --defaults-file=/etc/mysql/my2.cnf &

我收到:
2017-03-22T08:31:21.684121Z 0 [Note] mysqld (mysqld 5.7.17-0ubuntu0.16.10.1) starting as process 13676 ...
2017-03-22T08:31:21.687115Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-03-22T08:31:21.687131Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-22T08:31:21.687135Z 0 [Note] InnoDB: Uses event mutexes
2017-03-22T08:31:21.687140Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-03-22T08:31:21.687143Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-03-22T08:31:21.687147Z 0 [Note] InnoDB: Using Linux native AIO
2017-03-22T08:31:21.687281Z 0 [Note] InnoDB: Number of pools: 1
2017-03-22T08:31:21.687344Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2017-03-22T08:31:21.688116Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-03-22T08:31:21.693801Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-03-22T08:31:21.694846Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the $
2017-03-22T08:31:21.708807Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-22T08:31:21.776053Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-03-22T08:31:21.776228Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-03-22T08:31:21.825266Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-03-22T08:31:21.826338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-03-22T08:31:21.826359Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-03-22T08:31:21.826695Z 0 [Note] InnoDB: Waiting for purge to start
2017-03-22T08:31:21.880277Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2535531
2017-03-22T08:31:21.881286Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql2/ib_buffer_pool
2017-03-22T08:31:21.881581Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-03-22T08:31:21.887687Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170322 14:01:21
2017-03-22T08:31:21.890330Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without cer$
2017-03-22T08:31:21.890380Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3307
2017-03-22T08:31:21.890407Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2017-03-22T08:31:21.890695Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2017-03-22T08:31:21.890791Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld2.sock.lock.
2017-03-22T08:31:21.890807Z 0 [ERROR] Unable to setup unix socket lock file.
2017-03-22T08:31:21.890819Z 0 [ERROR] Aborting

我错过了什么?

最佳答案

对于使用 apparmor 的用户,请在 /etc/apparmor.d/usr.sbin.mysqld 中获得以下权限允许 mysqld 创建和使用锁定文件。

/var/run/mysqld/mysqld2.pid rw,
/var/run/mysqld/mysqld2.sock rw,
/var/run/mysqld/mysqld2.sock.lock rw,

然后以 root 身份运行以下命令以重新加载配置文件。
apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld

出于某种原因,我在没有 rw 的情况下收到了 OP 的错误所有这三个文件的权限。

关于Mysql 5.7 无法创建 unix socket 锁定文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42946925/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com