Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Percona/MySQL unattended on Ubuntu

I can install MYSQL on Ubuntu without prompts with the code below:

dbpass="mydbpassword"
export DEBIAN_FRONTEND=noninteractive
echo mysql-server-5.1 mysql-server/root_password password $dbpass | debconf-set-selections
echo mysql-server-5.1 mysql-server/root_password_again password $dbpass | debconf-set-selections
apt-get -y install mysql-server

The part with the debconf-set-selections I got somewhere online (could be here can't remember) and it has worked ok for me thus far. I'm not that much of an expert to understand how it works but it does.

However, I want to do the same thing for Percona. I've setup the apt package manager to deal with using apt-get for percona. So now my code is the following:

dbpass="dbpass" && export dbpass
export DEBIAN_FRONTEND=noninteractive
echo percona-server-server-5.5 percona-server-server-5.5/root_password password $dbpass | debconf-set-selections
echo percona-server-server-5.5 percona-server-server-5.5/root_password_again password $dbpass | debconf-set-selections
apt-get -y install percona-server-server-5.5

However, Percona installs but without a password as defined. I know I'm missing something in the debconf bit.

I'd appreciate some guidance here.

Thanks in advance.

like image 236
ObiHill Avatar asked Mar 16 '12 20:03

ObiHill


2 Answers

I actually found that the answer here install mysql on ubuntu without password prompt that suggested

export DEBIAN_FRONTEND=noninteractive apt-get -q -y install mysql-server

Worked and left me with a root user with no password, which is what I wanted.

like image 54
John Russell Avatar answered Oct 03 '22 18:10

John Russell


The second part of the debconf-prefix should not contain the version number:

echo percona-server-server-5.5 percona-server-server/root_password password $dbpass | sudo debconf-set-selections
echo percona-server-server-5.5 percona-server-server/root_password_again password $dbpass | sudo debconf-set-selections

For 5.6:

echo percona-server-server-5.6 percona-server-server/root_password password $dbpass | sudo debconf-set-selections
echo percona-server-server-5.6 percona-server-server/root_password_again password $dbpass | sudo debconf-set-selections
like image 44
F21 Avatar answered Oct 03 '22 17:10

F21