在Ubuntu与Centos下,自动化部署脚本略有不同
Ubuntu:
#!/bin/bash
   echo mysql-server mysql-server/root_password password "PASSWD"|debconf-set-selections
    echo mysql-server mysql-server/root_password_again password "PASSWD"|debconf-set-selections
  apt-get install mariadb-server python-mysqldb
  service mysql restart
   mysql_secure_installation  
 mysql -uroot -phtYun@2014<
EOF

在CentOS下:
 #!/bin/bash
  yum install mariadb mariadb-server MySQL-python -y
  systemctl enable mariadb.service
  systemctl start mariadb.service
  mysqladmin -u root flush-privileges password "PASSWD"
  mysql -uroot -phtYun@2014<

笔者试图重定向到一个sql文件中执行,但一直失败
 #mysql -uroot -p -hlocalhost>/root/adduser.sql
不知道优惠

 
11-24 22:43