pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<tfoot id='9fJUr'></tfoot>

<small id='9fJUr'></small><noframes id='9fJUr'>

          <bdo id='9fJUr'></bdo><ul id='9fJUr'></ul>
      1. <legend id='9fJUr'><style id='9fJUr'><dir id='9fJUr'><q id='9fJUr'></q></dir></style></legend>
        <i id='9fJUr'><tr id='9fJUr'><dt id='9fJUr'><q id='9fJUr'><span id='9fJUr'><b id='9fJUr'><form id='9fJUr'><ins id='9fJUr'></ins><ul id='9fJUr'></ul><sub id='9fJUr'></sub></form><legend id='9fJUr'></legend><bdo id='9fJUr'><pre id='9fJUr'><center id='9fJUr'></center></pre></bdo></b><th id='9fJUr'></th></span></q></dt></tr></i><div class="bpvn7lp" id='9fJUr'><tfoot id='9fJUr'></tfoot><dl id='9fJUr'><fieldset id='9fJUr'></fieldset></dl></div>

        在 ubuntu 上使用 ansible 安裝 MySQL

        Install MySQL with ansible on ubuntu(在 ubuntu 上使用 ansible 安裝 MySQL)
        <i id='Px8rc'><tr id='Px8rc'><dt id='Px8rc'><q id='Px8rc'><span id='Px8rc'><b id='Px8rc'><form id='Px8rc'><ins id='Px8rc'></ins><ul id='Px8rc'></ul><sub id='Px8rc'></sub></form><legend id='Px8rc'></legend><bdo id='Px8rc'><pre id='Px8rc'><center id='Px8rc'></center></pre></bdo></b><th id='Px8rc'></th></span></q></dt></tr></i><div class="fvffvjv" id='Px8rc'><tfoot id='Px8rc'></tfoot><dl id='Px8rc'><fieldset id='Px8rc'></fieldset></dl></div>
      2. <tfoot id='Px8rc'></tfoot>

        <small id='Px8rc'></small><noframes id='Px8rc'>

          <bdo id='Px8rc'></bdo><ul id='Px8rc'></ul>
        • <legend id='Px8rc'><style id='Px8rc'><dir id='Px8rc'><q id='Px8rc'></q></dir></style></legend>

                    <tbody id='Px8rc'></tbody>

                  本文介紹了在 ubuntu 上使用 ansible 安裝 MySQL的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我在流浪的 ubuntu 上安裝帶有 ansible 的 MySQL 時遇到問題,

                  I have a problem installing MySQL with ansible on a vagrant ubuntu,

                  這是我的 MySQL 部分

                  This is my MySQL part

                  ---
                  - name: Install MySQL
                    apt:
                      name: "{{ item }}"
                    with_items:
                      - python-mysqldb
                      - mysql-server
                  
                  - name: copy .my.cnf file with root password credentials
                    template: 
                      src: templates/root/.my.cnf
                      dest: ~/.my.cnf
                      owner: root
                      mode: 0600
                  
                  - name: Start the MySQL service
                    service: 
                      name: mysql 
                      state: started
                      enabled: true
                  
                    # 'localhost' needs to be the last item for idempotency, see
                    # http://ansible.cc/docs/modules.html#mysql-user
                  - name: update mysql root password for all root accounts
                    mysql_user: 
                      name: root 
                      host: "{{ item }}" 
                      password: "{{ mysql_root_password }}" 
                      priv: "*.*:ALL,GRANT"
                    with_items:
                      - "{{ ansible_hostname }}"
                      - 127.0.0.1
                      - ::1
                      - localhost 
                  

                  我有這個錯誤

                  failed: [default] => (item=vagrant-ubuntu-trusty-64) => {"failed": true, "item": "vagrant-ubuntu-trusty-64"}
                  msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
                  failed: [default] => (item=127.0.0.1) => {"failed": true, "item": "127.0.0.1"}
                  msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
                  failed: [default] => (item=::1) => {"failed": true, "item": "::1"}
                  msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
                  failed: [default] => (item=localhost) => {"failed": true, "item": "localhost"}
                  msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
                  

                  我的 .my.cnf 是

                  my .my.cnf is

                  [client]
                  user=root
                  password={{ mysql_root_password }}
                  

                  當復制到服務器上時

                  [client]
                  user=root
                  password=root
                  

                  我不明白為什么,創建了 ~/.my.cnf

                  I don't understand why, ~/.my.cnf is created

                  項目 Github

                  謝謝

                  推薦答案

                  mysql-server 無頭安裝時,沒有密碼.因此,要使 .my.cnf 工作,它應該有一個空白的密碼行.這是我為 .my.cnf 測試的內容:

                  When mysql-server is installed headlessly, there's no password. Therefore to make .my.cnf work, it should have a blank password line. Here's what I tested with for a .my.cnf:

                  [client]
                  user=root
                  password=
                  

                  .my.cnf 放在您的 vagrant 用戶目錄中也有點奇怪,因為它由 root 擁有并且只能作為 root 讀取.

                  It's also slightly strange to put .my.cnf in your vagrant user directory as owned by root and only readable as root.

                  確保 .my.cnf 中的密碼為空后,我能夠在這四個上下文中正確設置 root 的密碼.請注意,此后它無法運行,因為需要更新 .my.cnf,因此它無法通過冪等性測試.

                  After ensuring the password was blank in .my.cnf, I was able to properly set the password for root in those four contexts. Note that it fails to run after that, since .my.cnf would need to be updated, so it fails the idempotency test.

                  ansible mysql_user 模塊頁面上有一條注釋,建議先寫密碼,然后然后.my.cnf 文件.如果你這樣做,你需要一個 where 子句到 mysql_user 操作(可能在此之前有一個文件統計信息).

                  There's a note on the ansible mysql_user module page that suggests writing the password and then writing the .my.cnf file. If you do that, you need a where clause to the mysql_user action (probably with a file stat before that).

                  更優雅的是將 check_implicit_adminlogin_userlogin_password 一起使用.這真是冪等的.

                  Even more elegant is to use check_implicit_admin along with login_user and login_password. That's beautifully idempotent.

                  作為第三種方式,也許 check_implicit_admin 會更容易.

                  As a third way, perhaps check_implicit_admin makes it even easier.

                  這是我成功的劇本,展示了上述內容,并在幾臺新服務器上進行了測試.有點為此感到自豪.注意所有這些都不需要 .my.cnf.

                  Here's my successful playbook showing the above, tested with a few fresh servers. Kinda proud of this. Note .my.cnf is unnecessary for all of this.

                  ---
                  - hosts: mysql
                    vars:
                      mysql_root_password: fart
                    tasks:
                    - name: Install MySQL
                      apt: name={{ item }} update_cache=yes cache_valid_time=3600 state=present
                      sudo: yes
                      with_items:
                      - python-mysqldb
                      - mysql-server
                    #- name: copy cnf
                    #  copy: src=.my.cnf dest=~/.my.cnf owner=ubuntu mode=0644
                    #  sudo: yes
                    - name: Start the MySQL service
                      sudo: yes
                      service: 
                        name: mysql 
                        state: started
                        enabled: true
                    - name: update mysql root password for all root accounts
                      sudo: yes
                      mysql_user: 
                        name: root 
                        host: "{{ item }}" 
                        password: "{{ mysql_root_password }}"
                        login_user: root
                        login_password: "{{ mysql_root_password }}"
                        check_implicit_admin: yes
                        priv: "*.*:ALL,GRANT"
                      with_items:
                        - "{{ ansible_hostname }}"
                        - 127.0.0.1
                        - ::1
                        - localhost 
                  

                  (編輯-刪除了 my.cnf)

                  (edit- removed my.cnf)

                  這篇關于在 ubuntu 上使用 ansible 安裝 MySQL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  How to use MySQL in WSL (Windows Subsystem for Linux)?(如何在 WSL(Linux 的 Windows 子系統)中使用 MySQL?)
                  PowerShell MySQL Backup Script Error in Task Scheduler 0x00041301(任務計劃程序中的 PowerShell MySQL 備份腳本錯誤 0x00041301)
                  Import the data from the XML files into a MySQL database(將數據從 XML 文件導入 MySQL 數據庫)
                  installed Xampp on Windows 7 32-bit. Errors when starting(在 Windows 7 32 位上安裝 Xampp.啟動時的錯誤)
                  Mysql lower case table on Windows xampp(Windows xampp 上的 Mysql 小寫表)
                    <tbody id='OF0Kv'></tbody>

                  <legend id='OF0Kv'><style id='OF0Kv'><dir id='OF0Kv'><q id='OF0Kv'></q></dir></style></legend>

                  <small id='OF0Kv'></small><noframes id='OF0Kv'>

                        <tfoot id='OF0Kv'></tfoot>
                          <bdo id='OF0Kv'></bdo><ul id='OF0Kv'></ul>
                          • <i id='OF0Kv'><tr id='OF0Kv'><dt id='OF0Kv'><q id='OF0Kv'><span id='OF0Kv'><b id='OF0Kv'><form id='OF0Kv'><ins id='OF0Kv'></ins><ul id='OF0Kv'></ul><sub id='OF0Kv'></sub></form><legend id='OF0Kv'></legend><bdo id='OF0Kv'><pre id='OF0Kv'><center id='OF0Kv'></center></pre></bdo></b><th id='OF0Kv'></th></span></q></dt></tr></i><div class="vjzdlhp" id='OF0Kv'><tfoot id='OF0Kv'></tfoot><dl id='OF0Kv'><fieldset id='OF0Kv'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 检验科改造施工_DSA手术室净化_导管室装修_成都特殊科室建设厂家_医疗净化工程公司_四川华锐 | 南京泽朗生物科技有限公司-液体饮料代加工_果汁饮料代加工_固体饮料代加工 | 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 阜阳在线-阜阳综合门户 | CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | 连栋温室大棚建造厂家-智能玻璃温室-薄膜温室_青州市亿诚农业科技 | 橡胶膜片,夹布膜片,橡胶隔膜密封,泵阀设备密封膜片-衡水汉丰橡塑科技公司网站 | 诸城网站建设-网络推广-网站优化-阿里巴巴托管-诸城恒泰互联 | 美甲贴片-指甲贴片-穿戴美甲-假指甲厂家--薇丝黛拉 | 智能风向风速仪,风速告警仪,数字温湿仪,综合气象仪(气象五要素)-上海风云气象仪器有限公司 | 高低温试验箱-模拟高低温试验箱订制-北京普桑达仪器科技有限公司【官网】 | 上海电子秤厂家,电子秤厂家价格,上海吊秤厂家,吊秤供应价格-上海佳宜电子科技有限公司 | 土壤检测仪器_行星式球磨仪_土壤团粒分析仪厂家_山东莱恩德智能科技有限公司 | 三价铬_环保铬_环保电镀_东莞共盈新材料贸易有限公司 | 网站seo优化_seo云优化_搜索引擎seo_启新网络服务中心 | SMC-ASCO-CKD气缸-FESTO-MAC电磁阀-上海天筹自动化设备官网 | 阀门智能定位器_电液动执行器_气动执行机构-赫尔法流体技术(北京)有限公司 | 扫地车厂家-山西洗地机-太原电动扫地车「大同朔州吕梁晋中忻州长治晋城洗地机」山西锦力环保科技有限公司 | 酒精检测棒,数显温湿度计,酒安酒精测试仪,酒精检测仪,呼气式酒精检测仪-郑州欧诺仪器有限公司 | 北京租车公司_汽车/客车/班车/大巴车租赁_商务会议/展会用车/旅游大巴出租_北京桐顺创业租车公司 | 北京浩云律师事务所-企业法律顾问_破产清算等公司法律服务 | 探鸣起名网-品牌起名-英文商标起名-公司命名-企业取名包满意 | 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | PO膜_灌浆膜及地膜供应厂家 - 青州市鲁谊塑料厂 | 光纤测温-荧光光纤测温系统-福州华光天锐光电科技有限公司 | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 电机保护器-电动机综合保护器-上海硕吉电器有限公司 | 深圳公司注册-工商注册公司-千百顺代理记账公司 | 依维柯自动挡房车,自行式国产改装房车,小型房车价格,中国十大房车品牌_南京拓锐斯特房车 - 南京拓锐斯特房车 | 杭州月嫂技术培训服务公司-催乳师培训中心报名费用-产后康复师培训机构-杭州优贝姆健康管理有限公司 | 黑龙江「京科脑康」医院-哈尔滨失眠医院_哈尔滨治疗抑郁症医院_哈尔滨精神心理医院 | 伟秀电气有限公司-10kv高低压开关柜-高低压配电柜-中置柜-充气柜-欧式箱变-高压真空断路器厂家 | 超声波电磁流量计-液位计-孔板流量计-料位计-江苏信仪自动化仪表有限公司 | 网站建设-高端品牌网站设计制作一站式定制_杭州APP/微信小程序开发运营-鼎易科技 | 中医治疗皮肤病_潍坊银康医院「山东」重症皮肤病救治平台 | 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 | 空压机网_《压缩机》杂志| 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 安全,主动,被动,柔性,山体滑坡,sns,钢丝绳,边坡,防护网,护栏网,围栏,栏杆,栅栏,厂家 - 护栏网防护网生产厂家 |