Bitnami phpMyAdmin for Amazon Web Services

phpMyAdmin is an easy to use management tool for MySQL that allows you to create and drop databases, create, drop and modify tables, delete, edit and add fields, execute SQL statements, manage keys on fields, manage privileges and export data in various formats through a web-based interface.

How to access phpMyAdmin?

For security reasons, phpMyAdmin is accessible only when using 127.0.0.1 as the hostname. To access it from a remote system, you must create an SSH tunnel that routes requests to the Apache Web server from 127.0.0.1. This implies that you must be able to connect to your server over SSH in order to access these applications remotely.

IMPORTANT: Before following the steps below, ensure that your Apache and MySQL servers are running.
NOTE: The steps below suggest using port 8888 for the SSH tunnel. If this port is already in use by another application on your local machine, replace it with any other port number greater than 1024 and modify the steps below accordingly. Similarly, if you have enabled Varnish, your stack's Apache Web server might be running on port 81. In this case, modify the steps below to use port 81 instead of port 80 for the tunnel endpoint.

Windows

To access the application using your Web browser, create an SSH tunnel, as described below.

  • Download PuTTY and make sure you can log in to the server console with it following the instructions in the FAQ. Once you have confirmed you are able to log in successfully, log back out.

  • Reconnect to the server using PuTTY, this time adapting the steps to include an additional SSH tunnel. When configuring the new SSH session in PuTTY, additionally navigate to the "Connection -> SSH -> Tunnels" section and create a secure tunnel by forwarding port 80 on the server to port 8888 on the local host (127.0.0.1 or localhost).

  • Click the "Add" button to add the secure tunnel configuration to the session. Here is an example:

    PuTTY configuration

  • Go back to the "Session" section and save your changes by clicking the "Save" button.

  • Click the "Open" button to open an SSH session to the server. The SSH session will now include a secure SSH tunnel between the two specified ports.

While the tunnel is active, you should be able to access the phpMyAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin.

To log in, use username root for MySQL and the application password from the detail page for your cloud server.

If you are unable to access phpMyAdmin, verify that the SSH tunnel was created by checking the PuTTY event log (accessible via the "Event Log" menu):

PuTTY configuration

Linux and Mac OS X

To access the application using your Web browser, create an SSH tunnel, as described below.

  • Open a new terminal window on your local system (for example, using "Finder -> Applications -> Utilities -> Terminal" in Mac OS X or the Dash in Ubuntu).

  • Make sure you can log in to the server console following the instructions in the FAQ. Once you have confirmed you are able to log in successfully, log back out.

  • Run the following command to configure the SSH tunnel. Remember to replace SERVER-IP with the public IP address or hostname of your server. Enter your SSH password when prompted.

     $ ssh -N -L 8888:127.0.0.1:80 bitnami@SERVER-IP
    

    If you are using a private key to connect to the server, use the following command instead, remembering to replace KEYFILE with the path to your private key and SERVER-IP with the public IP address or hostname of your server:

     $ ssh -N -L 8888:127.0.0.1:80 -i KEYFILE bitnami@SERVER-IP
    
    NOTE: If successful, the above commands will create an SSH tunnel but will not display any output on the server console.

While the tunnel is active, you should be able to access the phpMyAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin.

To log in, use username root for MySQL and the application password from the detail page for your cloud server.

How to change the phpMyAdmin password?

The phpMyAdmin credentials are the same as those used to access the MySQL database. To modify the password, refer to this page.

How to increase the security of phpMyAdmin's login pages?

If you would like, add an additional layer of security by enabling Apache's authentication when accessing phpMyAdmin. Follow these steps:

  • Edit the /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf file and add the following lines outside the Directory directive.

     <Location /phpmyadmin>
        AuthType Basic
        AuthName phpMyAdmin
        AuthUserFile "/opt/bitnami/apache2/users"
        Require valid-user
     </Location>
    
  • Change or set the phpMyAdmin access password using the following command and replacing PASSWORD with the new password:

     $ sudo /opt/bitnami/apache2/bin/htpasswd -cb /opt/bitnami/apache2/users administrator PASSWORD
    
  • Restart Apache to have the changes take effect:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    

Now, when accessing phpMyAdmin, users will be prompted to log in twice: first, with the username administrator and second, with the username root. The password for the first is the one set in the second step above. The password for the second can be obtained from the server launchpad or control panel.

How to export a database?

Follow these steps:

  • Log in to the included phpMyAdmin application using these instructions.

  • Select the application database in the left navigation menu. In this example, the database is named bitnami_wordpress.

  • Select the "Export" menu item.

    Database export

  • On the resulting page, select the "Quick" export method and the "SQL" output format.

  • Click "Go".

    Database export

An SQL export file will be created and downloaded to your desktop. Store this file carefully, as you will need it if you plan to later import the database back into MySQL.

How to modify the allowed limit for uploaded files?

Modify the following option in the /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf file to increase the allowed size for uploads:

<IfModule php5_module>                                                                    
    php_value upload_max_filesize 80M
    php_value post_max_size 80M
</IfModule>

If you are using PHP-FPM, modify the settings in the /opt/bitnami/apps/phpmyadmin/conf/php-fpm/php-settings.conf file

php_value[upload_max_filesize]=80M
php_value[post_max_size]=80M

How to modify the execution time?

This parameter sets the timeout for Apache to run a script.

  • Modify it in the php.ini file.

     max_execution_time = 120     ; Maximum execution time of each script, in seconds
    
  • Modify the ExecTimeLimit value in the /opt/bitnami/apps/phpmyadmin/htdocs/config.inc.php file:

     $cfg['ExecTimeLimit'] = 120;
    

To set this execution timeout to be unlimited (apply this value only if really necessary), set the time limit to 0 in both cases.

Troubleshooting

Timeout error when importing zipped database

If you try to import a zipped database, you might see a timeout error because phpMyAdmin takes too long to execute the script. To fix this:

  • Set the ExecTimeLimit setting to 0 (infinite) as described here.

  • Try to import the file again.

Remember to change the ExecTimeLimit setting back to its original value once the import process ends.