<i id='hse94'><tr id='hse94'><dt id='hse94'><q id='hse94'><span id='hse94'><b id='hse94'><form id='hse94'><ins id='hse94'></ins><ul id='hse94'></ul><sub id='hse94'></sub></form><legend id='hse94'></legend><bdo id='hse94'><pre id='hse94'><center id='hse94'></center></pre></bdo></b><th id='hse94'></th></span></q></dt></tr></i><div id='hse94'><tfoot id='hse94'></tfoot><dl id='hse94'><fieldset id='hse94'></fieldset></dl></div>

    1. <small id='hse94'></small><noframes id='hse94'>

      <tfoot id='hse94'></tfoot>

      • <bdo id='hse94'></bdo><ul id='hse94'></ul>

      1. <legend id='hse94'><style id='hse94'><dir id='hse94'><q id='hse94'></q></dir></style></legend>

        在没有密码提示的情况下在 Ubuntu 上安装 MySQL

        Install MySQL on Ubuntu without a password prompt(在没有密码提示的情况下在 Ubuntu 上安装 MySQL)

      2. <small id='qU9rw'></small><noframes id='qU9rw'>

              <tbody id='qU9rw'></tbody>

                <tfoot id='qU9rw'></tfoot>
                  <bdo id='qU9rw'></bdo><ul id='qU9rw'></ul>

                  <legend id='qU9rw'><style id='qU9rw'><dir id='qU9rw'><q id='qU9rw'></q></dir></style></legend>
                  <i id='qU9rw'><tr id='qU9rw'><dt id='qU9rw'><q id='qU9rw'><span id='qU9rw'><b id='qU9rw'><form id='qU9rw'><ins id='qU9rw'></ins><ul id='qU9rw'></ul><sub id='qU9rw'></sub></form><legend id='qU9rw'></legend><bdo id='qU9rw'><pre id='qU9rw'><center id='qU9rw'></center></pre></bdo></b><th id='qU9rw'></th></span></q></dt></tr></i><div id='qU9rw'><tfoot id='qU9rw'></tfoot><dl id='qU9rw'><fieldset id='qU9rw'></fieldset></dl></div>
                  本文介绍了在没有密码提示的情况下在 Ubuntu 上安装 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  如何编写脚本在 Ubuntu 上安装 MySQL 服务器?

                  How do I write a script to install MySQL server on Ubuntu?

                  sudo apt-get install mysql 会安装,但也会要求在控制台输入密码.

                  sudo apt-get install mysql will install, but it will also ask for a password to be entered in the console.

                  如何以非交互式方式执行此操作?也就是写个脚本可以提供密码?

                  How do I do this in a non-interactive way? That is, write a script that can provide the password?

                  #!/bin/bash
                  sudo apt-get install mysql  # To install MySQL server
                  
                  # How to write script for assigning password to MySQL root user
                  # End
                  

                  推荐答案

                  sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password your_password'
                  sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password your_password'
                  sudo apt-get -y install mysql-server
                  

                  对于特定版本,例如mysql-server-5.6,您需要像这样指定版本:

                  For specific versions, such as mysql-server-5.6, you'll need to specify the version in like this:

                  sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password password your_password'
                  sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password_again password your_password'
                  sudo apt-get -y install mysql-server-5.6
                  

                  对于 mysql-community-server,key 略有不同:

                  For mysql-community-server, the keys are slightly different:

                  sudo debconf-set-selections <<< 'mysql-community-server mysql-community-server/root-pass password your_password'
                  sudo debconf-set-selections <<< 'mysql-community-server mysql-community-server/re-root-pass password your_password'
                  sudo apt-get -y install mysql-community-server
                  

                  将 your_password 替换为所需的 root 密码.(似乎 your_password 也可以为空白 root 密码留空.)

                  Replace your_password with the desired root password. (it seems your_password can also be left blank for a blank root password.)

                  如果您的 shell 不支持 here-strings(zshksh93bash 支持它们),使用:

                  If your shell doesn't support here-strings (zsh, ksh93 and bash support them), use:

                  echo ... | sudo debconf-set-selections 
                  

                  这篇关于在没有密码提示的情况下在 Ubuntu 上安装 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
                  MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
                  Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
                  How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
                  Update row with data from another row in the same table(使用同一表中另一行的数据更新行)
                  Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)
                • <i id='cMgit'><tr id='cMgit'><dt id='cMgit'><q id='cMgit'><span id='cMgit'><b id='cMgit'><form id='cMgit'><ins id='cMgit'></ins><ul id='cMgit'></ul><sub id='cMgit'></sub></form><legend id='cMgit'></legend><bdo id='cMgit'><pre id='cMgit'><center id='cMgit'></center></pre></bdo></b><th id='cMgit'></th></span></q></dt></tr></i><div id='cMgit'><tfoot id='cMgit'></tfoot><dl id='cMgit'><fieldset id='cMgit'></fieldset></dl></div>

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

                    <bdo id='cMgit'></bdo><ul id='cMgit'></ul>
                      <tbody id='cMgit'></tbody>

                      <tfoot id='cMgit'></tfoot>

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