My OS is CentOS 6.6, and I want to know how to install a mysql server automatically through a shell script.
I found that there is a topic dedicated to the same problem, but it did not cope with CentOS 6: install mysql on ubuntu without a password prompt
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'
Error message
bash: debconf-set-selections: command not found
Here is my main script
#!/bin/sh # Make sure only root can run our script if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi #password setting root_password='abc123' #install mysql-server yum install mysql mysql-server #start service service mysqld start #MySQL Initial Setup mysql_secure_installation #This command needs root password and answers(y/n) for secure questions
Are there any methods to automatically populate the root password and answer "y" to most of the secure questions.
Or he has an alternative way to achieve the same. That is, a script to install myaql server automatically and without a password prompt.
very grateful for your help.
source share