When setting up a server or group of servers for the first time you may find yourself wanting to create MySQL users without having to login to MySQL. It would make sense for the mysqladmin command to offer this functionality but it does not. Instead you can create the MySQL user with the mysql command as shown in the below example performed on a server running Ubuntu Linux 12.04 also known as Precise Pangolin.
The purpose of this article is to list the variables that are available to set when installing mysql-server on Ubuntu Linux. You can use the debconf-get-selections command to list debconf variables for any installed package on Ubuntu but the debconf variables are most useful before a package is installed so I constantly find myself having to login to another Ubuntu server where the package is already installed to get these variables. Now I can just look on QD.
I find myself on a regular basis looking for various debconf variables to set before installing packages on Ubuntu. This is typically to not have to type in the answers on the various configuration screens or because I want to script an install of some package. If the package has never been installed before on that specific server then the debconf variables will not display. You can always login to another server where the package is installed to see the variables but I am going to start posting information for common packages here so others can easily find them when searching.
If you have used the debconf-set-selections command that I mentioned in a previous article there will likely be more questions that come up over time such as how to view variables that have been set for specific packages or how to flush the debconf database. Below I show a couple example that explain how to view variables in the debconf database and also how to remove those variables from the database.
If you need to complete an unattended installation or scripted install of MySQL On Ubuntu Linux you can do so easily by setting the necessary variable with debconf-set-selections. Typically when you install MySQL on Ubuntu it will pop up a window and ask for you to enter a password even when you have specified -y with apt-get install. Below are the commands necessary to set the password variable which then allow you to automatically install MySQL on Ubuntu.