Categories: Debian 7Debian 8Linux

How To automate MySQL installation on Debian 7 & 8

First of all to use the following script you need to have debconf on your machine. To install debconf, follow the first step. If you already have debconf, start by the second step.

1. If you don’t have debconf
apt-get install debconf
This command works on Debian 7/8 and might also work on Ubuntu 12/13/14, but I don’t have tested it.

2. Create a file and put the content below in it.
Don’t forget to replace ROOT_MYSQL_PASSWORD_YOU_WANT with the password you want!

#MySQL version
mysqlVersion=5.5
#Variable that contains the password you want to be set for the root user of MySQL
mysqlPassword='ROOT_MYSQL_PASSWORD_YOU_WANT'
#Préconfiguration des paramètres
echo "mysql-server-${mysqlVersion} mysql-server/root_password password ${mysqlPassword}" | debconf-set-selections
echo "mysql-server-${mysqlVersion} mysql-server/root_password_again password ${mysqlPassword}" | debconf-set-selections 
#Installation de MySQL
apt-get -y install mysql-client mysql-server-${mysqlVersion}

3. Start your script with bash ./your_file.sh and enjoy!

The GrimmChester

View Comments

Share
Published by
The GrimmChester
Tags: mysql

Recent Posts

How to set up a SIP trunk with FreePBX and Twilio

FreePBX Server Requirements FreePBX 14.0 Asterisk 13 1 Twilio Number Mine will be (579)123-1234 Notes:…

8 years ago

Automated Web Hosting Solution (AWHS)Panel

Requirements For now, AWHSPanel only supports Debian 8 but its architecture allows easy new implementations.…

9 years ago

How to install ioncube on Debian & Ubuntu

ionCube installation What is ionCube: ionCube helps you to protect your PHP code from being…

10 years ago

Comment rediriger un site HTTP vers HTTPS

RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

10 years ago

How To Install Linux, Nginx, MySQL, PHP (LEMP) on Debian 8

Files Structure: /srv /mydomain.com /.socks /www /cgi-bin /logs /public_html /ssl /tmp /blog /cgi-bin /logs /public_html…

10 years ago

How To automate Horde Groupware Webmail installation

Prerequisites: - 1 database (mysql) - 1 user associated with the database - Follow this…

10 years ago