Bitnami phpMyAdmin

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 virtual machine 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 virtual machine 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 virtual machine 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 virtual machine 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 virtual machine. 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. The default password is bitnami.

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 virtual machine 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 IP address of your virtual machine. 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 virtual machine, use the following command instead, remembering to replace KEYFILE with the path to your private key and SERVER-IP with the IP address of your virtual machine:

     $ 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. The default password is bitnami.

Alternatively, if you are running the virtual machine in a secure environment, you can enable access to phpMyAdmin from hosts other than 127.0.0.1 by editing the /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf file and modifying the Allow and Require directives as below:

  Default directive Modified directive
Apache 2.2 Allow from 127.0.0.1 Allow from all
Apache 2.4+ Require local Require all granted

You can also use the example configuration file below if you wish:

<IfDefine USE_PHP_FPM>
    <Proxy "unix:/opt/bitnami/php/var/run/phpmyadmin.sock|fcgi://phpmyadmin-fpm" timeout=300>
    </Proxy>
</IfDefine>

<Directory "/opt/bitnami/apps/phpmyadmin/htdocs">
  # AuthType Basic
  # AuthName phpMyAdmin   
  # AuthUserFile "/opt/bitnami/apache2/users" 
  # Require valid-user                              
  AllowOverride None

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

  <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    Satisfy all
  </IfVersion>
  <IfVersion >= 2.3>
    Require all granted
  </IfVersion>
  
  ErrorDocument 403 "For security reasons, this URL is only accessible using localhost (127.0.0.1) as the hostname"

  <IfDefine USE_PHP_FPM>
     <FilesMatch \.php$>
       SetHandler "proxy:fcgi://phpmyadmin-fpm/"
     </FilesMatch>
  </IfDefine>

</Directory>

Restart Apache to have the changes take effect:

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

You should now be able to access phpMyAdmin by browsing to http://SERVER-IP/phpmyadmin.

To log in, use username root for MySQL. The default password is bitnami.

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