Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
安装mysql外壳脚本并设置根密码_Mysql_Shell - Fatal编程技术网

安装mysql外壳脚本并设置根密码

安装mysql外壳脚本并设置根密码,mysql,shell,Mysql,Shell,我需要工作人员制作一个shell脚本,安装带有yum的mysql服务器,但是需要安装它自动设置mysql的根密码! 大多数人都不知道该怎么做。有人能帮我吗?一种方法是事后指定密码(当您知道默认密码时) 查看全文 更多资源: [1] 配置管理 [2] 配置管理 mysqladmin -u root password <NEW_PASS> sudo debconf-set-selections <<< 'mysql-server mysql-server/root_p

我需要工作人员制作一个shell脚本,安装带有yum的mysql服务器,但是需要安装它自动设置mysql的根密码!
大多数人都不知道该怎么做。有人能帮我吗?

一种方法是事后指定密码(当您知道默认密码时)

查看全文

更多资源:

[1] 配置管理

[2] 配置管理

mysqladmin -u root password <NEW_PASS>
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password <NEW_PASS>'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password <NEW_PASS>'
sudo apt-get -y install mysql-server
class mysql-server {
     $password = "insert_password_here"
     package { "MySQL-client": ensure => installed }
     package { "MySQL-server": ensure => installed }
     package { "MySQL-shared": ensure => installed }

     exec { "Set MySQL server root password":
       subscribe => [ Package["MySQL-server"], Package["MySQL-client"], Package["MySQL-shared"] ],
       refreshonly => true,
       unless => "mysqladmin -uroot -p$password status",
       path => "/bin:/usr/bin",
       command => "mysqladmin -uroot password $password",
     }
}