Cannot Access PHPMyAdmin on a WordPress Droplet with UserDate PhpMyAdmin installation

Posted August 18, 2015 5.4k views
UbuntuMySQLWordPressControl PanelsDigitalOcean 1-Click Apps Marketplace

I’ve created a new WordPress Droplet and used User-Data to install PhpMyAdmin.

When I try to access:

I Receive 401 Unauthorized.

I’ve tried do use MYSQL root user using the password displayed at MOTD
I’ve tried “phpmyadmin” using the password available at /etc/dbconfig-common/phpmyadmin.conf
I’ve tried do use WordPress DB user/pass available at wp-config.php

What Im missing?
I just need to open PHPMyAdmin to restore the full DB from my old blog domain so I can start using DO for my website.

Here’s the 401 error:

  • What user data commands did you use to install phpmyadmin?

  • Hey Ryan! Thanks for your help.

    I’ve used this script available at:


    aptupdate: true
    upgrade: true

    • apache2
    • apache2-utils
    • php5-mysql
    • mysql-server
    • libapache2-mod-php5
    • php5-mcrypt
    • php5-gd
    • php5-curl
    • phpmyadmin write_files:
    • path: /usr/share/phpmyadmin/.htaccess content: | AuthType Basic AuthName “Restricted Files” AuthUserFile /etc/phpmyadmin/.htpasswd Require valid-user runcmd: # Configure Apache
    • php5enmod mcrypt
    • sed -ie “s/index.html index.cgi index.php/index.php index.html index.cgi” /etc/apache2/mods-enabled/dir.conf
    • sed -ie “s/index.php/index.php\n\tAllowOverride\ All/” /etc/phpmyadmin/apache.conf
    • ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

    # Generate random passwords for the MySql root user and the .htaccess file

    • PHPMYADMINPASS=dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev
    • MYSQLPASS=dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev
    • mysqladmin -u root -h localhost password “$MYSQLPASS”
    • echo “[client]\npassword=”$MYSQLPASS"\n" > /root/.my.cnf # The .htaccess username defaults to phpmyadmin. Update the line below to change that.
    • echo $PHPMYADMINPASS | htpasswd -c -i /etc/phpmyadmin/.htpasswd phpmyadmin
    • echo “phpMyAdmin Password - ”$PHPMYADMINPASS"“ > /root/phpmyadmin
    • echo "MySql Password - ”“$MYSQLPASS”“” >> /root/phpmyadmin

    # Enable the conf and restart Apache.

    • a2enconf phpmyadmin.conf
    • service apache2 restart

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Do you see any errors in /var/log/cloud-init-output.log ?

The user data script is attempting to install and configure some things that are already configured by the WordPress one-click. The quickest way to get up and running with your migrated site would be to rebuild the droplet from the WordPress image and then log in via ssh. Using the following commands you’ll be able to install PHPMyAdmin.

Make sure you have the MySQL root password from the MOTD, then…

apt-get update
apt-get install phpmyadmin

You should be prompted for some information by apt.

Select the option to configure apache and provide the MySQL root password when prompted for it. You will also set up a phpmyadmin user.

Once this has completed you can access phpmyadmin at /phpmyadmin via a web browser.