1. 安装mysql,就不说了。
2. 将数据目录修改到home下:
修改/etc/my.cnf,将datadir=/var/lib/mysql改为 datadir=/home/mysql/data
这时启动mysqld就应该可以了,但我启动时报错:
bash-5.1$ sudo systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.
看/var/log/mysqld.log:
2025-02-18T11:56:53.718686Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.41) initializing of server in progress as process 16685
2025-02-18T11:56:53.720480Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2025-02-18T11:56:53.720509Z 0 [ERROR] [MY-013236] [Server] The designated data directory /home/mysql/data/ is unusable. You can remove all files
that the server added to it.
2025-02-18T11:56:53.720564Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-02-18T11:56:53
MySQL数据目录放home下启动报错解决

最低0.47元/天 解锁文章
1736

被折叠的 条评论
为什么被折叠?



