- 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.
推薦閱讀
- Splunk 7 Essentials(Third Edition)
- Introduction to DevOps with Kubernetes
- Go Machine Learning Projects
- Hadoop 2.x Administration Cookbook
- Hands-On Neural Networks with Keras
- Learning Social Media Analytics with R
- Google App Inventor
- 計算機網絡應用基礎
- Maya 2012從入門到精通
- STM32G4入門與電機控制實戰:基于X-CUBE-MCSDK的無刷直流電機與永磁同步電機控制實現
- 80x86/Pentium微型計算機原理及應用
- 水晶石精粹:3ds max & ZBrush三維數字靜幀藝術
- AutoCAD 2012中文版繪圖設計高手速成
- 控制系統計算機仿真
- RedHat Linux用戶基礎