askubuntu.com,我需要一些帮助来调试我的MySQL设置!在过去的几年里,我一直在Dropbox上托管我的本地开发资源,它一直运作得很好。在过去的一周里,我决定擦除我的电脑,这次用Ubuntu代替Linux (不相干,但太棒了!)因此,关于重要的细节:
/etc/mysql/mysql.conf.d/mysqld.cnf中的datadir条目被定义为datadir = "/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql"。
/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases 777的权限(看起来很悲伤,但我现在正试图消除这种可能性),所有者用户/组是mysql:mysql,递归的。
我在/etc/apparmor.d/tunables/alias中将Apparmor别名定义为alias /var/lib/mysql/ -> "/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/",。我还将条目添加到/etc/apparmor.d/usr.sbin.mysqld中,如
# Allow data dir access
/var/lib/mysql/ r,
"/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/" r,
/var/lib/mysql/** rwk,
"/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/**" rwk,此外,在我的测试中,我将MySQL从使用(MySQL的如何禁用装甲)的指令列表中删除,因此Apparmor根本不应该影响流程。我来自sudo aa-status的输出是
apparmor module is loaded.
39 profiles are loaded.
39 profiles are in enforce mode.
/snap/core/9289/usr/lib/snapd/snap-confine
/snap/core/9289/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/snapd/7777/usr/lib/snapd/snap-confine
/snap/snapd/7777/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/bin/evince
/usr/bin/evince-previewer
/usr/bin/evince-previewer//sanitized_helper
/usr/bin/evince-thumbnailer
/usr/bin/evince//sanitized_helper
/usr/bin/man
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/NetworkManager/nm-dhcp-helper
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/lib/snapd/snap-confine
/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/sbin/cups-browsed
/usr/sbin/cupsd
/usr/sbin/cupsd//third_party
/usr/sbin/tcpdump
/{,usr/}sbin/dhclient
ippusbxd
lsb_release
man_filter
man_groff
nvidia_modprobe
nvidia_modprobe//kmod
snap-update-ns.core
snap-update-ns.gimp
snap-update-ns.snap-store
snap-update-ns.spotify
snap.core.hook.configure
snap.gimp.gimp
snap.gimp.hook.install
snap.gimp.hook.post-refresh
snap.snap-store.snap-store
snap.snap-store.ubuntu-software
snap.snap-store.ubuntu-software-local-file
snap.spotify.spotify
0 profiles are in complain mode.
3 processes have profiles defined.
3 processes are in enforce mode.
/usr/sbin/cups-browsed (1066)
/usr/sbin/cupsd (980)
/snap/snap-store/454/usr/bin/snap-store (2422) snap.snap-store.ubuntu-software
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.命令sudo service mysql start生成输出
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.命令journalctrl -xe的mysqld输出是
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.016428Z 0 [Warning] [MY-010091] [Server] Can't create test file /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.016478Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20-0ubuntu0.20.04.1) starting as process 6655
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.018301Z 0 [Warning] [MY-010091] [Server] Can't create test file /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.018309Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/ is case insensitive
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.018491Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to '/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/' (OS errno: 13 - Permission denied)
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.018547Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun 12 19:28:26 tehccount mysqld[6655]: 2020-06-12T23:28:26.018619Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20-0ubuntu0.20.04.1) (Ubuntu).
Jun 12 19:28:26 tehccount systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE命令sudo systemctl status mysql.service的输出是
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-06-12 19:28:27 EDT; 5min ago
Process: 6671 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 6679 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 6679 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 13 (Permission denied)
Jun 12 19:28:27 tehccount systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jun 12 19:28:27 tehccount systemd[1]: Stopped MySQL Community Server.
Jun 12 19:28:27 tehccount systemd[1]: mysql.service: Start request repeated too quickly.
Jun 12 19:28:27 tehccount systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 12 19:28:27 tehccount systemd[1]: Failed to start MySQL Community Server.命令sudo -u mysql /usr/sbin/mysqld的输出是
2020-06-12T23:36:08.460482Z 0 [Warning] [MY-010091] [Server] Can't create test file /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2020-06-12T23:36:08.460535Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20-0ubuntu0.20.04.1) starting as process 6866
2020-06-12T23:36:08.462316Z 0 [Warning] [MY-010091] [Server] Can't create test file /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2020-06-12T23:36:08.462334Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/ is case insensitive
2020-06-12T23:36:08.462514Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to '/home/tehccount/Dropbox/DesignInk Digital/Kyle/Development Databases/mysql/' (OS errno: 13 - Permission denied)
2020-06-12T23:36:08.462555Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-06-12T23:36:08.462622Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20-0ubuntu0.20.04.1) (Ubuntu).使用cd /home/tehccount/Dropbox/DesignInk\ Digital/Kyle/Development\ Databases/mysql/导航到预期的mysql,然后使用命令sudo -u mysql touch testfile.txt成功地创建文件/home/tehccount/Dropbox/DesignInk /Kyle/Development数据库/mysql/testfile.txt
尽管我尽了最大的努力,每天工作8个小时,但我一直无法理解为什么/usr/sbin/mysqld进程不能开始。应该从Apparmor中删除MySQL,并将datadir的权限设置为一个神奇的自由主义777权限。在使用带有Apparmor和适当权限的Linux之前,我已经成功地做到了这一点。欢迎任何建议,谢谢。
发布于 2020-06-16 12:06:13
我犯了同样的错误,我做了和你做的完全一样的事情,得到了同样的结果。
我正在移动/var/lib/mysql => /media/{user}/data/mysql
我的解决办法:
$ sudo chmod 777 /media/{user}/我的猜测是,我可以将数据目录从/media/{user}/中挂载,并且应该也能正常工作。
提示:如果AppArmor阻止了您,它将在journalctl -xe的输出中告诉您。
发布于 2023-02-03 18:01:26
https://askubuntu.com/questions/1249792
复制相似问题