How can I install MySQL on Ubuntu without having to enter a password during the process?
Installing MySQL using sudo apt-get install mysql prompts for password input, which can be inconvenient in non-interactive scenarios or when scripting the installation.
To bypass the password prompt, use the following script:
#!/bin/bash sudo debconf-set-selectionsReplace your_password with your desired password. For specific versions (e.g., mysql-server-5.6), specify the version as shown below:
sudo debconf-set-selectionsFor mysql-community-server, use the following keys:
sudo debconf-set-selectionsYou can also use debconf-get-selections to verify your settings:
sudo debconf-get-selections | grep ^mysql
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3