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

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.

主站蜘蛛池模板: 九龙坡区| 重庆市| 柳河县| 江门市| 长宁区| 三台县| 安国市| 张掖市| 岱山县| 双牌县| 德令哈市| 泗阳县| 陆川县| 河北区| 勃利县| 雅安市| 浙江省| 莱阳市| 庆元县| 伊宁市| 杂多县| 鹿邑县| 北安市| 巩义市| 岳普湖县| 辽阳市| 会东县| 惠安县| 三穗县| 萨迦县| 敦化市| 镇平县| 东源县| 奉化市| 迭部县| 庄浪县| 临朐县| 鄂温| 富顺县| 阿拉善盟| 贵南县|