官术网_书友最值得收藏!

Setting up MySQL database

We have already seen how to set up MySQL in the previous chapter. Here, we will see how to create new users and databases for the WordPress application. Then we will apply the hardening steps via Ansible modules:

- name: create WordPress database
mysql_db:
name: "{{ WordPress_database_name }}"
state: present
login_user: root
login_password: "{{ mysql_root_password }}"

- name: create WordPress database user
mysql_user:
name: "{{ WordPress_database_username }}"
password: "{{ WordPress_database_password }}"
priv: '"{{ WordPress_database_name }}".*:ALL'
state: present
login_user: root
login_password: "{{ mysql_root_password }}"

The preceding code snippet describes creating a new database and user and assigning that user full permission to the WordPress application database using the mysql_db and mysql_user modules, respectively.

主站蜘蛛池模板: 邛崃市| 明溪县| 同德县| 兰西县| 余江县| 平潭县| 宁海县| 三河市| 长武县| 龙陵县| 绵阳市| 沂南县| 廊坊市| 合水县| 昌平区| 新宾| 镇康县| 乌拉特中旗| 铁力市| 青铜峡市| 绥德县| 从化市| 西乌珠穆沁旗| 北安市| 潞西市| 广东省| 阿克苏市| 电白县| 铜川市| 卢湾区| 蓝田县| 鄂托克旗| 廊坊市| 东阳市| 平顶山市| 理塘县| 潼关县| 张北县| 武乡县| 探索| 朝阳市|