Debian apt mysql password-less Installation

Source: Internet
Author: User

Debian apt mysql password-less installation in debian install mysql database only need apt-get install mysql-server-5.x, and then a dialog box will pop up during the installation process, ask you to enter the password of the mysql root Account. If you want to install mysql on 100 machines in batches, it will be troublesome. Do you need to set the password for one machine? There are shortcuts to google's findings. Download the deb package of mysql but not install it. apt can be implemented. The following operations are performed on debian6: 1 www.2cto.com <span style = "font-size: 14px; font-family: 'Microsoft yahei'; "> apt-get-d install mysql-server-5.1 </span>-d means download-only downloads, the package downloaded by debian is in the/var/cache/apt/archives directory by default.
The dpkg-preconfigure command is used to import the debconf database of the related package. Before the package is installed, it is displayed that it has interaction questions to answer. Go to the/var/cache/apt/archives directory and run the following command: 1 <span style = "font-size: 14px; font-family: 'Microsoft yahei '; "> dpkg-preconfigure mysql-server-5.1_5.1.49-3_amd64.deb </span> www.2cto.com debconf-show command can query the related package debconf database
You can see that two passwords need to be set. Create a mysql-passwd file in the/tmp directory and enter the following content for the file to take effect:

Apt-get clean clears the cached package and starts to install mysql using apt. No dialog box is displayed during the installation process. The password setting box is not displayed, then, log on to the database with the 123456 password set in mysql-passwd, and then change the root password to 999999 Logon: www.2cto.com. Everything works, so that you do not need to set a password when installing mysql in batches, it can also be extended to other software packages. The following describes some of the package management commands used above: debconf-set-selections: insert the default value in the debconf database. Useage: debconf-set-selections file debconf-get-selections | ssh newhost debconf-set-selections www.2cto.com file data format <owner> <question name> <question type> <value> data is behavior unit, the Rows starting with # Are comments, and empty rows are ignored. The default values of other rows should contain four values, separated by a space, there is only one space or tab between the type and value: any extra space will be interpreted as part of the value. A line can be divided into multiple lines by the backslash ("\") at the end of the line. It is better to split a row after the problem. Splitting between types and values is a bad practice. When a split row is connected, the space at the beginning and end of the row is reduced to a space, and then a separate row is formed. For the debconf variable (Template) used by the installer, the owner should be set to "d-I". To preset the variable in the installed system, use a software package whose name contains the corresponding debconf template. Only those variables whose owner is not "d-I" will be saved to the debconf database of the installed system. To check the available answer values, you can use the files under nano check/var/lib/cdebconf during installation. Templates. dat is the original template, and questions. dat is the value set by the current variable. You can use debconf-set-selections-c file to check if the configuration file is incorrectly formatted before installation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.