如何在没有密码提示的情况下安装MySQL?
这个问题是从Stack Overflow 迁移过来的,因为可以在Ask Ubuntu上回答。 迁移 8年前。 我试图在没有密码提示的情况下在Ubuntu Natty上安装MySQL。但是,在主安装后的某个阶段,我总是不断提示输入密码。 另外,当我输入我认为应该是我的密码(mymysqlpass)的密码时,它会给我一个拒绝访问的通知。然后,当脚本终止时,我可以不使用密码即mysql -uroot登录mysql,这应该不会发生。 #!/bin/bash #This script installs mysql (latest build) #Install MYSQL Server mysql_pass=mymysqlpass export DEBIAN_FRONTEND=noninteractive debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password password '$mysql_pass'' debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password_again password '$mysql_pass'' apt-get -y install mysql-server #Configure Password and Settings for Remote Access cp /etc/mysql/my.cnf /etc/mysql/my.bak.cnf ip=`ifconfig …