!/bin/bash
apt-get install -y mysql-server
通过脚本安装mysql时,如何自动输入mysql root密码
PHP中文网2017-04-17 12:07:57
If you install it with root, you don’t need a password.
If you are an ordinary user and call sudo directly, you can only use methods such as expect, or change /etc/sudoers so that you do not need to enter a password.
PHP中文网2017-04-17 12:07:57
mysql -u root -ppasswd
root is the username, passwd is the user’s password
Note that there should be no space between -p and password
Is this what you mean?