2

我正在尝试设置一个 vagrant 框并让它自动安装 Nginx、php、mysql 和 phpmyadmin 作为开发框。前三个安装和工作没有问题,但是 phpmyadmin 总是返回一个错误,说没有使用没有密码的 root 访问。然而,据我所知,我已经在 debconf 设置中设置了所有相关信息。

这是我的设置脚本的主要部分:

#!/bin/bash
sudo su

export DEBIAN_FRONTEND=noninteractive

#apt-get update -q

# Set root password for mysql
debconf-set-selections <<< 'mysql-server mysql-server/root_password password rootpass'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password rootpass'
# Set phpmyadmin paramaters for install
debconf-set-selections <<< 'phpmyadmin/debconfig-install boolean true'
debconf-set-selections <<< 'phpmyadmin/mysql/admin-user string root'
debconf-set-selections <<< 'phpmyadmin/mysql/admin-pass password rootpass'
debconf-set-selections <<< 'phpmyadmin/mysql/app-pass password rootpass'
debconf-set-selections <<< 'phpmyadmin/app-password-confirm password rootpass'
debconf-set-selections <<< 'phpmyadmin/reconfigure-websever multiselect none'
debconf-set-selections <<< 'phpmyadmin/database-type select mysql'
debconf-set-selections <<< 'phpmyadmin/setup-password password rootpass'    

# Install mysql, nginx, php5-fpm
apt-get install -q -y -f mysql-server nginx php5-fpm

# Install commonly used php packages
apt-get install -q -y -f phpmyadmin php5-mysql php5-mcrypt php5-curl

和错误信息

==> default: Setting up phpmyadmin (4:4.0.10-1) ...
==> default: dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
==> default: Creating config file /etc/dbconfig-common/phpmyadmin.conf with new version
==> default: Creating config file /etc/phpmyadmin/config-db.php with new version
==> default: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO).
==> default: unable to connect to mysql server.
==> default: error encountered creating user:
==> default: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
==> default: dbconfig-common: phpmyadmin configure: noninteractive fail.
==> default: dbconfig-common: phpmyadmin configure: ignoring errors from here forwards
==> default: populating database via sql...  
==> default: done.
==> default: dbconfig-common: flushing administrative password

可能设置的设置比要求的要多,但我一直在尝试远程看起来与密码相关的所有内容!

4

1 回答 1

3

抱歉,但我希望这对将来的某人有所帮助:(我错过了一个关键要素,整个早上都让我头疼。

我错过了对象类型:

debconf-set-selections <<< 'phpmyadmin/debconfig-install boolean true'

应该读:

debconf-set-selections <<< 'phpmyadmin phpmyadmin/debconfig-install boolean true'

注意开头的 phpmyadmin!哎呀!

于 2015-10-20T09:16:49.417 回答