2

I am trying to set a vagrant box and have it automatically install Nginx, php, mysql and phpmyadmin as a development box. The first three install and work no problem but phpmyadmin always returns an error saying there is no access for root using no password. I have however as far as I know set-up all relevant info in the debconf settings.

Here's the main part of my setup script:

#!/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

And the error message

==> 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

There may well be more setting set than required but I have been trying everything that ever remotely looks like is password related!

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Gavin
  • 711
  • 1
  • 5
  • 13

1 Answers1

3

Sorry but I hope this helps someone in future :( I missed a key element and its been giving me a headache all morning.

I missed the object type at the being:

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

Should read:

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

Notice the phpmyadmin at the beginning! Opps!

Gavin
  • 711
  • 1
  • 5
  • 13