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

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.

主站蜘蛛池模板: 青阳县| 石阡县| 浑源县| 句容市| 石城县| 广安市| 尉犁县| 延庆县| 织金县| 福海县| 玉山县| 马龙县| 永善县| 元阳县| 游戏| 平舆县| 盐津县| 大渡口区| 新安县| 分宜县| 塔河县| 永安市| 兰坪| 通化市| 平安县| 张家口市| 肥西县| 新邵县| 陇川县| 友谊县| 日照市| 辉县市| 腾冲县| 溧阳市| 始兴县| 乌拉特后旗| 安仁县| 滦平县| 崇文区| 东明县| 阳江市|