gpt4 book ai didi

mysql - 在安装在/var/lib/mysql上的lv上安装mysql-server 5.7

转载 作者:行者123 更新时间:2023-11-29 16:41:30 27 4
gpt4 key购买 nike

自 2 周以来,我一直致力于 MySQL 部署以及 Ansible 方面的工作。我必须在 LV 上安装 MySQL。

在 MySQL 部署之前,Ansible 脚本会创建 /var/lib/mysql、LV 并将其挂载到 /var/lib/mysql 上。然后,它创建MySQL用户和MySQL组,在MySQL目录上设置0700权限。完成后,Ansible 部署 MySQL 5.7。

我的 Ansible 代码的一部分:

- name: "Group : mysql"
group:
name: "mysql"
state: "present"
tags:
- User mysql

- name: "user : mysql"
user:
name: "mysql"
shell: "mysql"
group: "mysql"
createhome: "no"
append: "True"
state: "present"
tags:
- User

- name: "Set rights on mysql dir "
file:
path: "/var/lib/mysql"
owner: "mysql"
group: "mysql"
mode: 0700
tags:
- mysql dir rights

- name: "mysql root password"
debconf:
name: "mysql-server"
question: "mysql-server/root_password"
value: "{{ password_root_mysql }}"
vtype: "password"
when: password_root_mysql is defined
tags:
- Install

- name: "mysql root password confirmation"
debconf:
name: "mysql-server"
question: "mysql-server/root_password_again"
value: "{{ password_root_mysql }}"
vtype: "password"
when: password_root_mysql is defined
tags:
- Install mysql

- name: "Install : MySQL Server"
apt:
update_cache: "True"
name: "mysql-server"
install_recommends: "True"
tags:
- Install mysql
notify:
- stop mysql

- name: "Copie du template root.cnf.j2 vers root/.my.cnf "
template:
src: "{{ mysql_template_rootcnf }}"
dest: "~/.my.cnf"
owner: "root"
mode: "0600"
tags:
- Install mysql

因此,当我尝试在没有任何 LV 和目录设置的情况下安装 mysql-server 时,它可以工作。但是当我准备好权限的MySQL目录时,安装不起作用,无论是手动部署还是自动部署。

有什么想法吗?

Ubuntu 16.04 with MYSQL 5.7. Ansible v2.7

最佳答案

好的,我发现问题了,/var/lib/mysql 中的 Lost+Found 目录(lv 安装在其上)被视为数据库,mysql 不喜欢它。在我的代码中,我刚刚添加了:

- name: "Remove lost+found from {{ mysql_dir }}"
file:
path: "{{ mysql_dir }}/lost+found"
state: absent

关于mysql - 在安装在/var/lib/mysql上的lv上安装mysql-server 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53317716/

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