php my Admin Documentation chapter 3
Installation
phpMyAdmin does not apply any special security methods to the MySQL database server. It is still the system
administrator’s job to grant permissions on the MySQL databases properly. phpMyAdmin’s Users page can be used
for this.
Warning: Mac users should note that if you are on a version before Mac OS X, StuffIt unstuffs with Mac formats.
So you’ll have to resave as in BBEdit to Unix style ALL phpMyAdmin scripts before uploading them to your
server, as PHP seems not to like Mac-style end of lines character (“\r”).
3.1 Linux distributions
phpMyAdmin is included in most Linux distributions. It is recommended to use distribution packages when possible
- they usually provide integration to your distribution and you will automatically get security updates from your
distribution.
3.1.1 Debian
Debian’s package repositories include a phpMyAdmin package, but be aware that the configuration file is maintained
in /etc/phpmyadmin and may differ in some ways from the official phpMyAdmin documentation. Specifically it
does:
• Configuration of web server (works for Apache and lighttpd).
• Creating of phpMyAdmin configuration storage using dbconfig-common.
• Securing setup script, see Setup script on Debian, Ubuntu and derivatives.
See also:
More information can be found in README.Debian (it is installed as /usr/share/doc/phmyadmin/README.
Debian with the package).
3.1.2 OpenSUSE
OpenSUSE already comes with phpMyAdmin package, just install packages from the openSUSE Build Service.
3.1.3 Ubuntu
Ubuntu ships phpMyAdmin package, however if you want to use recent version, you can use packages from php-
MyAdmin PPA.
See also:
The packages are same as in Debian please check the documentation there for more details.
3.1.4 Gentoo
Gentoo ships the phpMyAdmin package, both in a near stock configuration as well as in a webapp-config config-
uration. Use emerge dev-db/phpmyadmin to install.
3.1.5 Mandriva
Mandriva ships the phpMyAdmin package in their contrib branch and can be installed via the usual Control Center.
3.1.6 Fedora
Fedora ships the phpMyAdmin package, but be aware that the configuration file is maintained in /etc/
phpMyAdmin/ and may differ in some ways from the official phpMyAdmin documentation.
3.1.7 Red Hat Enterprise Linux
Red Hat Enterprise Linux itself and thus derivatives like CentOS don’t ship phpMyAdmin, but the Fedora-driven
repository Extra Packages for Enterprise Linux (EPEL) is doing so, if it’s enabled. But be aware that the config-
uration file is maintained in /etc/phpMyAdmin/ and may differ in some ways from the official phpMyAdmin
documentation.
3.2 Installing on Windows
The easiest way to get phpMyAdmin on Windows is using third party products which include phpMyAdmin together
with a database and web server such as XAMPP.
You can find more of such options at Wikipedia.
3.3 Installing from Git
You can clone current phpMyAdmin source from https://github.com/phpmyadmin/phpmyadmin.git:
git clone https://github.com/phpmyadmin/phpmyadmin.git
Additionally you need to install dependencies using the Composer tool:
composer update
If you do not intend to develop, you can skip the installation of developer tools by invoking:
composer update --no-dev
3.4 Installing using Composer
You can install phpMyAdmin using the Composer tool, since 4.7.0 the releases are automatically mirrored to the
default Packagist repository.
Note: The content of the Composer repository is automatically generated separately from the releases, so the content
doesn’t have to be 100% same as when you download the tarball. There should be no functional differences though.
To install phpMyAdmin simply run:
composer create-project phpmyadmin/phpmyadmin
Alternatively you can use our own composer repository, which contains the release tarballs and is available at <https:
//www.phpmyadmin.net/packages.json>:
composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.
˓→net/packages.json --no-dev
3.5 Installing using Docker
phpMyAdmin comes with a Docker image, which you can easily deploy. You can download it using:
docker pull phpmyadmin/phpmyadmin
The phpMyAdmin server will listen on port 80. It supports several ways of configuring the link to the database server,
either by Docker’s link feature by linking your database container to db for phpMyAdmin (by specifying --link
your_db_host:db) or by environment variables (in this case it’s up to you to set up networking in Docker to allow
the phpMyAdmin container to access the database container over network).
3.5.1 Docker environment variables
You can configure several phpMyAdmin features using environment variables:
PMA_ARBITRARY
Allows you to enter a database server hostname on login form.
See also:
$cfg['AllowArbitraryServer']
PMA_HOST
Host name or IP address of the database server to use.
See also:
$cfg['Servers'][$i]['host']
PMA_HOSTS
Comma-separated host names or IP addresses of the database servers to use.
Note: Used only if PMA_HOST is empty.
PMA_VERBOSE
Verbose name of the database server.
See also:
$cfg['Servers'][$i]['verbose']
PMA_VERBOSES
Comma-separated verbose name of the database servers.
Note: Used only if PMA_VERBOSE is empty.
PMA_USER
User name to use for Config authentication mode.
PMA_PASSWORD
Password to use for Config authentication mode.
PMA_PORT
Port of the database server to use.
PMA_PORTS
Comma-separated ports of the database server to use.
Note: Used only if PMA_PORT is empty.
PMA_ABSOLUTE_URI
The fully-qualified path (https://pma.example.net/) where the reverse proxy makes phpMyAdmin
available.
See also:
$cfg['PmaAbsoluteUri']
By default, Cookie authentication mode is used, but if PMA_USER and PMA_PASSWORD are set, it is switched to
Config authentication mode.
Note: The credentials you need to log in are stored in the MySQL server, in case of Docker image there are various
ways to set it (for example MYSQL_ROOT_PASSWORD when starting the MySQL container). Please check documen-
tation for MariaDB container or MySQL container.
3.5.2 Customizing configuration
Additionally configuration can be tweaked by /etc/phpmyadmin/config.user.inc.php. If this file
exists, it will be loaded after configuration is generated from above environment variables, so you can over-
ride any configuration variable. This configuration can be added as a volume when invoking docker using -v
/some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php parameters.
Note that the supplied configuration file is applied after Docker environment variables, but you can override any of the
values.
For example to change default behaviour of CSV export you can use following configuration file:
<?php
$cfg['Export']['csv_columns'] = true;
?>
You can also use it to define server configuration instead of using the environment variables listed in Docker environ-
ment variables:
<?php
/* Override Servers array */
$cfg['Servers'] = [
1 => [
'auth_type' => 'cookie',
'host' => 'mydb1',
'port' => 3306,
'verbose' => 'Verbose name 1',
],
2 => [
'auth_type' => 'cookie',
'host' => 'mydb2',
'port' => 3306,
'verbose' => 'Verbose name 2',
],
];
See also:
See Configuration for detailed description of configuration options.
3.5.3 Docker Volumes
You can use following volumes to customize image behavior:
/etc/phpmyadmin/config.user.inc.php
Can be used for additional settings, see previous chapter for more details.
/sessions/
Directory where PHP sessions are stored. You might want to share this for example when using Signon
authentication mode.
/www/themes/
Directory where phpMyAdmin looks for themes. By default only those shipped with phpMyAdmin are
included, but you can include additional phpMyAdmin themes (see Custom Themes) by using Docker volumes.
3.5.4 Docker Examples
To connect phpMyAdmin to a given server use:
docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
Chapter 4 coming soon