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

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.

主站蜘蛛池模板: 迁安市| 岳普湖县| 丹凤县| 清原| 岳池县| 建始县| 庐江县| 额敏县| 临沭县| 隆尧县| 明溪县| 赫章县| 瓦房店市| 射洪县| 民丰县| 长春市| 兴国县| 开远市| 沁源县| 武川县| 余姚市| 福州市| 荆州市| 民县| 江陵县| 内乡县| 中山市| 钟山县| 冕宁县| 渑池县| 株洲市| 青冈县| 太原市| 精河县| 黄梅县| 山阴县| 拉孜县| 梧州市| 淮南市| 天峻县| 万山特区|