- Security Automation with Ansible 2
- Madhu Akula Akash Mahajan
- 117字
- 2021-07-02 21:59:59
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.
推薦閱讀
- Mastering Proxmox(Third Edition)
- Dreamweaver CS3+Flash CS3+Fireworks CS3創(chuàng)意網(wǎng)站構(gòu)建實(shí)例詳解
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)·基礎(chǔ)模塊
- 自動(dòng)化控制工程設(shè)計(jì)
- STM32嵌入式微控制器快速上手
- Splunk Operational Intelligence Cookbook
- 學(xué)會(huì)VBA,菜鳥也高飛!
- Dreamweaver CS6精彩網(wǎng)頁(yè)制作與網(wǎng)站建設(shè)
- HTML5 Canvas Cookbook
- 手機(jī)游戲策劃設(shè)計(jì)
- ZigBee無(wú)線通信技術(shù)應(yīng)用開發(fā)
- 未來(lái)學(xué)徒:讀懂人工智能飛馳時(shí)代
- 工業(yè)控制系統(tǒng)安全
- Modern Big Data Processing with Hadoop
- Data Science with Python