saltstack在state.sls中创建数据库和用户名

栏目: 数据库 · 发布时间: 6年前

内容简介:saltstack在state.sls中创建数据库和用户名
查看原有的数据库信息:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.00 sec)
state.sls文件:
[[email protected]
_master base]# cat mysql_test.sls pkg_install: pkg.installed: - names: - MySQL-python - python-devel db_creat: mysql_database.present: - name: zabbix_test - connection_host: localhost - connection_user: root - connection_pass: qwe123 user_creat: mysql_user.present: - name: zabbix_test - host: localhost - password: zabbix_test - use: - mysql_database: db_creat user_grant: mysql_grants.present: - grant: all privileges - database: zabbix_test.* - user: zabbix_test - host: 'localhost' - use: - mysql_database: db_creat执行state.sls操作
[[email protected]
_master base]# salt 'zabbix_server' state.sls mysql_test zabbix_server: ---------- ID: pkg_install Function: pkg.installed Name: python-devel Result: True Comment: Package python-devel is already installed Started: 10:56:50.251481 Duration: 397.42 ms Changes: ---------- ID: pkg_install Function: pkg.installed Name: MySQL-python Result: True Comment: Package MySQL-python is already installed Started: 10:56:50.649097 Duration: 0.522 ms Changes: ---------- ID: db_creat Function: mysql_database.present Name: zabbix_test Result: True Comment: The database zabbix_test has been created Started: 10:56:50.650729 Duration: 4.404 ms Changes: ---------- zabbix_test: Present ---------- ID: user_creat Function: mysql_user.present Name: zabbix_test Result: True Comment: The userhas been added Started: 10:56:50.655521 Duration: 7.29 ms Changes: ---------- zabbix_test: Present ---------- ID: user_grant Function: mysql_grants.present Result: True Comment: Grant all privileges on zabbix_test.* tohas been added Started: 10:56:50.663209 Duration: 6.603 ms Changes: ---------- user_grant: Present Summary for zabbix_server ------------ Succeeded: 5 (changed=3) Failed: 0 ------------ Total states run: 5 Total run time: 416.239 ms查看结果:_server ~]# mysql -uzabbix_test -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 35 Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | zabbix_test | +--------------------+ 2 rows in set (0.00 sec)

以上所述就是小编给大家介绍的《saltstack在state.sls中创建数据库和用户名》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

推荐系统与深度学习

推荐系统与深度学习

黄昕、赵伟、王本友、吕慧伟、杨敏 / 清华大学出版社 / 2019-1-1 / 65.00元

本书的内容设置由浅入深,从传统的推荐算法过渡到近年兴起的深度学习技术。不管是初学者,还是有一定经验的从业人员,相信都能从本书的不同章节中有所收获。 区别于其他推荐算法书籍,本书引入了已被实践证明效果较好的深度学习推荐技术,包括Word2Vec、Wide & Deep、DeepFM、GAN 等技术应用,并给出了相关的实践代码;除了在算法层面讲解推荐系统的实现,还从工程层面详细阐述推荐系统如何搭建.一起来看看 《推荐系统与深度学习》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具