【发布时间】:2022-10-17 13:40:40
【问题描述】:
这将是一个漫长的过程。请阅读。 我创建了一个带有 1 TB 驱动器的新 Azure Ubuntu 18.04。设置很顺利。然后我使用这个link 安装了MySql 服务器。一切都很顺利。我能够毫无问题地启动mysql。
我的下一步是更改数据目录路径。我关注了这个guide。我与指南的唯一区别是sudo rsync -av /var/lib/mysql /mnt/MYSQLDATA。当我运行该命令时,它什么也没做。没有复制任何东西。我将其替换为 cp * -r /mnt/MYSQLDATA 以复制所有内容。
我跟着指南走到了最后。我将 mysql /etc/mysql/mysql.conf.d/mysqld.cnf 的 cnf 更改为:
datadir = /mnt/MYSQLDATA
接下来,我还更改了别名sudo nano /etc/apparmor.d/tunables/alias:
`# alias /var/lib/mysql/ -> /mnt/MYSQLDATA/`,
我想我必须更改 [/etc/apparmor.d/usr.sbin.mysqld][3] 配置。这是我使用的代码:
# Allow data dir access
/mnt/MYSQLDATA/ r,
/mnt/MYSQLDATA** rwk,
重新启动了apparmor。一切看起来都像是定好的。我什至去确保mysql是文件夹路径的所有者,所以我可以chown -R mysql:mysql /mnt/MYSQLDATA。现在是时候重新启动服务了,但它并没有重新启动。我不断得到
mysql.service 的作业失败,因为控制进程以错误代码退出。有关详细信息,请参阅“systemctl status mysql.service”和“journalctl -xe”。
2022-07-18T23:01:30.236755Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-18T23:01:30.236994Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.237046Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.38-0ubuntu0.18.04.1) starting as process 7569 ...
2022-07-18T23:01:30.240273Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.240311Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.244072Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-07-18T23:01:30.244101Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-07-18T23:01:30.244106Z 0 [Note] InnoDB: Uses event mutexes
2022-07-18T23:01:30.244110Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-07-18T23:01:30.244131Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-07-18T23:01:30.244135Z 0 [Note] InnoDB: Using Linux native AIO
2022-07-18T23:01:30.244437Z 0 [Note] InnoDB: Number of pools: 1
2022-07-18T23:01:30.244573Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-07-18T23:01:30.247391Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-07-18T23:01:30.255749Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-07-18T23:01:30.258357Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-07-18T23:01:30.268405Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-07-18T23:01:30.268428Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-07-18T23:01:30.268444Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-07-18T23:01:30.869299Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-07-18T23:01:30.869354Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-07-18T23:01:30.869360Z 0 [ERROR] Failed to initialize builtin plugins.
2022-07-18T23:01:30.869364Z 0 [ERROR] Aborting
2022-07-18T23:01:30.869421Z 0 [Note] Binlog end
2022-07-18T23:01:30.869518Z 0 [Note] Shutting down plugin 'CSV'
2022-07-18T23:01:30.869895Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
我不知道我做错了什么以及哪里出错了。在 journalctl -xe 中它只显示 mysql.services: control process exited, code=exited status=1 或 mysql.services: start request 重复太快。我正在拔头发,试图找出问题所在。请帮忙。
【问题讨论】:
-
我认为我们可以看到结果,但似乎缺少什么造成这种情况的原因。您更改的内容可能只是值得注意的,因为您更改了它们,我们不知道“指南”的其余部分告诉您什么,因此您可能会提供更多信息。像这样的时代,我只是想想单独使用Mysql Workbench的windows服务器成本如何让你的生活简单1000倍,除非你按小时付费,然后一路做unix。
-
是的,我放弃了。无法弄清楚为什么它一直失败。我得到的只是难以确定的一般错误。我一直都知道 linux 很糟糕,现在我可以确认它确实如此。这个软件见鬼了
-
值得称赞的是,较低的开销意味着您可以用更少的资源和更紧的软件和硬件预算完成更多工作,只是整个管理过程会变得更加乏味,但这只是我的看法。
标签: mysql ubuntu-18.04 datadirectory