6 phpMyAdmin does not apply any special security methods to the MySQL
7 database server. It is still the system administrator's job to grant
8 permissions on the MySQL databases properly. phpMyAdmin's :guilabel:`Users`
9 page can be used for this.
13 :term:`Mac` users should note that if you are on a version before
14 :term:`Mac OS X`, StuffIt unstuffs with :term:`Mac` formats. So you'll have
15 to resave as in BBEdit to Unix style ALL phpMyAdmin scripts before
16 uploading them to your server, as PHP seems not to like :term:`Mac`-style
17 end of lines character ("``\r``").
22 phpMyAdmin is included in most Linux distributions. It is recommended to use
23 distribution packages when possible - they usually provide integration to your
24 distribution and you will automatically get security updates from your distribution.
31 Debian's package repositories include a phpMyAdmin package, but be aware that
32 the configuration file is maintained in ``/etc/phpmyadmin`` and may differ in
33 some ways from the official phpMyAdmin documentation. Specifically it does:
35 * Configuration of web server (works for Apache and lighttpd).
36 * Creating of :ref:`linked-tables` using dbconfig-common.
37 * Securing setup script, see :ref:`debian-setup`.
41 More information can be found in `README.Debian <https://anonscm.debian.org/cgit/collab-maint/phpmyadmin.git/tree/debian/README.Debian>`_
42 (it is installed as :file:`/usr/share/doc/phmyadmin/README.Debian` with the package).
47 OpenSUSE already comes with phpMyAdmin package, just install packages from
48 the `openSUSE Build Service <https://software.opensuse.org/package/phpMyAdmin>`_.
53 Ubuntu ships phpMyAdmin package, however if you want to use recent version, you
55 `phpMyAdmin PPA <https://launchpad.net/~nijel/+archive/ubuntu/phpmyadmin>`_.
59 The packages are same as in :ref:`debian-package` please check the documentation
60 there for more details.
65 Gentoo ships the phpMyAdmin package, both in a near stock configuration as well
66 as in a ``webapp-config`` configuration. Use ``emerge dev-db/phpmyadmin`` to
72 Mandriva ships the phpMyAdmin package in their ``contrib`` branch and can be
73 installed via the usual Control Center.
78 Fedora ships the phpMyAdmin package, but be aware that the configuration file
79 is maintained in ``/etc/phpMyAdmin/`` and may differ in some ways from the
80 official phpMyAdmin documentation.
82 Red Hat Enterprise Linux
83 ------------------------
85 Red Hat Enterprise Linux itself and thus derivatives like CentOS don't
86 ship phpMyAdmin, but the Fedora-driven repository
87 `Extra Packages for Enterprise Linux (EPEL) <https://fedoraproject.org/wiki/EPEL>`_
89 `enabled <https://fedoraproject.org/wiki/EPEL/FAQ#howtouse>`_.
90 But be aware that the configuration file is maintained in
91 ``/etc/phpMyAdmin/`` and may differ in some ways from the
92 official phpMyAdmin documentation.
98 The easiest way to get phpMyAdmin on Windows is using third party products
99 which include phpMyAdmin together with a database and web server such as
100 `XAMPP <https://www.apachefriends.org/>`_.
102 You can find more of such options at `Wikipedia <https://en.wikipedia.org/wiki/List_of_AMP_packages>`_.
107 You can clone current phpMyAdmin source from
108 ``https://github.com/phpmyadmin/phpmyadmin.git``:
112 git clone https://github.com/phpmyadmin/phpmyadmin.git
114 Additionally you need to install dependencies using the `Composer tool`_:
120 If you do not intend to develop, you can skip the installation of developer tools
125 composer update --no-dev
130 Installing using Composer
131 +++++++++++++++++++++++++
133 You can install phpMyAdmin using the `Composer tool`_, since 4.7.0 the releases
134 are automatically mirrored to the default `Packagist`_ repository.
138 The content of the Composer repository is automatically generated
139 separately from the releases, so the content doesn't have to be
140 100% same as when you download the tarball. There should be no
141 functional differences though.
143 To install phpMyAdmin simply run:
147 composer create-project phpmyadmin/phpmyadmin
149 Alternatively you can use our own composer repository, which contains
150 the release tarballs and is available at
151 <https://www.phpmyadmin.net/packages.json>:
155 composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
159 Installing using Docker
160 +++++++++++++++++++++++
162 phpMyAdmin comes with a `Docker image`_, which you can easily deploy. You can
167 docker pull phpmyadmin/phpmyadmin
169 The phpMyAdmin server will listen on port 80. It supports several ways of
170 configuring the link to the database server, either by Docker's link feature
171 by linking your database container to ``db`` for phpMyAdmin (by specifying
172 ``--link your_db_host:db``) or by environment variables (in this case it's up
173 to you to set up networking in Docker to allow the phpMyAdmin container to access
174 the database container over network).
178 Docker environment variables
179 ----------------------------
181 You can configure several phpMyAdmin features using environment variables:
183 .. envvar:: PMA_ARBITRARY
185 Allows you to enter a database server hostname on login form.
187 .. seealso:: :config:option:`$cfg['AllowArbitraryServer']`
191 Host name or IP address of the database server to use.
193 .. seealso:: :config:option:`$cfg['Servers'][$i]['host']`
195 .. envvar:: PMA_HOSTS
197 Comma-separated host names or IP addresses of the database servers to use.
199 .. note:: Used only if :envvar:`PMA_HOST` is empty.
201 .. envvar:: PMA_VERBOSE
203 Verbose name of the database server.
205 .. seealso:: :config:option:`$cfg['Servers'][$i]['verbose']`
207 .. envvar:: PMA_VERBOSES
209 Comma-separated verbose name of the database servers.
211 .. note:: Used only if :envvar:`PMA_VERBOSE` is empty.
215 User name to use for :ref:`auth_config`.
217 .. envvar:: PMA_PASSWORD
219 Password to use for :ref:`auth_config`.
223 Port of the database server to use.
225 .. envvar:: PMA_PORTS
227 Comma-separated ports of the database server to use.
229 .. note:: Used only if :envvar:`PMA_PORT` is empty.
231 .. envvar:: PMA_ABSOLUTE_URI
233 The fully-qualified path (``https://pma.example.net/``) where the reverse
234 proxy makes phpMyAdmin available.
236 .. seealso:: :config:option:`$cfg['PmaAbsoluteUri']`
238 By default, :ref:`cookie` is used, but if :envvar:`PMA_USER` and
239 :envvar:`PMA_PASSWORD` are set, it is switched to :ref:`auth_config`.
243 The credentials you need to log in are stored in the MySQL server, in case
244 of Docker image there are various ways to set it (for example
245 :samp:`MYSQL_ROOT_PASSWORD` when starting the MySQL container). Please check
246 documentation for `MariaDB container <https://hub.docker.com/r/_/mariadb/>`_
247 or `MySQL container <https://hub.docker.com/r/_/mysql/>`_.
251 Customizing configuration
252 -------------------------
254 Additionally configuration can be tweaked by :file:`/etc/phpmyadmin/config.user.inc.php`. If
255 this file exists, it will be loaded after configuration is generated from above
256 environment variables, so you can override any configuration variable. This
257 configuration can be added as a volume when invoking docker using
258 `-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php` parameters.
260 Note that the supplied configuration file is applied after :ref:`docker-vars`,
261 but you can override any of the values.
263 For example to change default behaviour of CSV export you can use following
269 $cfg['Export']['csv_columns'] = true;
274 See :ref:`config` for detailed description of configuration options.
279 You can use following volumes to customize image behavior:
281 :file:`/etc/phpmyadmin/config.user.inc.php`
283 Can be used for additional settings, see previous chapter for more details.
287 Directory where PHP sessions are stored. You might want to share this
288 for example when using :ref:`auth_signon`.
292 Directory where phpMyAdmin looks for themes. By default only those shipped
293 with phpMyAdmin are included, but you can include additional phpMyAdmin
294 themes (see :ref:`themes`) by using Docker volumes.
299 To connect phpMyAdmin to a given server use:
303 docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
305 To connect phpMyAdmin to more servers use:
309 docker run --name myadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80 phpmyadmin/phpmyadmin
311 To use arbitrary server option:
315 docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
317 You can also link the database container using Docker:
321 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin/phpmyadmin
323 Running with additional configuration:
327 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin/phpmyadmin
329 Running with additional themes:
333 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /custom/phpmyadmin/theme/:/www/themes/theme/ phpmyadmin/phpmyadmin
338 Alternatively you can also use docker-compose with the docker-compose.yml from
339 <https://github.com/phpmyadmin/docker>. This will run phpMyAdmin with an
340 arbitrary server - allowing you to specify MySQL/MariaDB server on login page.
346 Customizing configuration file using docker-compose
347 ---------------------------------------------------
349 You can use an external file to customize phpMyAdmin configuration and pass it
350 using the volumes directive:
355 image: phpmyadmin/phpmyadmin
356 container_name: phpmyadmin
364 - ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
365 - /custom/phpmyadmin/theme/:/www/themes/theme/
367 .. seealso:: :ref:`docker-custom`
369 Running behind haproxy in a subdirectory
370 ----------------------------------------
372 When you want to expose phpMyAdmin running in a Docker container in a
373 subdirectory, you need to rewrite the request path in the server proxying the
376 For example using haproxy it can be done as:
383 option http-server-close
385 ### NETWORK restriction
386 acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
389 acl phpmyadmin path_dir /phpmyadmin
390 use_backend phpmyadmin if phpmyadmin LOCALNET
395 reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
397 # phpMyAdmin container IP
398 server localhost 172.30.21.21:80
400 When using traefik, something like following should work:
404 defaultEntryPoints = ["http"]
408 [entryPoints.http.redirect]
409 regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
414 [backends.myadmin.servers.myadmin]
415 url="http://internal.address.to.pma"
420 passHostHeader = true
421 [frontends.myadmin.routes.default]
422 rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
424 You then should specify :envvar:`PMA_ABSOLUTE_URI` in the docker-compose
434 image: phpmyadmin/phpmyadmin
435 container_name: phpmyadmin
437 domainname: example.com
441 - PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
442 - PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
445 - PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
452 #. Choose an appropriate distribution kit from the phpmyadmin.net
453 Downloads page. Some kits contain only the English messages, others
454 contain all languages. We'll assume you chose a kit whose name
455 looks like ``phpMyAdmin-x.x.x -all-languages.tar.gz``.
456 #. Ensure you have downloaded a genuine archive, see :ref:`verify`.
457 #. Untar or unzip the distribution (be sure to unzip the subdirectories):
458 ``tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz`` in your
459 webserver's document root. If you don't have direct access to your
460 document root, put the files in a directory on your local machine,
461 and, after step 4, transfer the directory on your web server using,
463 #. Ensure that all the scripts have the appropriate owner (if PHP is
464 running in safe mode, having some scripts with an owner different from
465 the owner of other scripts will be a problem). See :ref:`faq4_2` and
466 :ref:`faq1_26` for suggestions.
467 #. Now you must configure your installation. There are two methods that
468 can be used. Traditionally, users have hand-edited a copy of
469 :file:`config.inc.php`, but now a wizard-style setup script is provided
470 for those who prefer a graphical installation. Creating a
471 :file:`config.inc.php` is still a quick way to get started and needed for
472 some advanced features.
475 Manually creating the file
476 --------------------------
478 To manually create the file, simply use your text editor to create the
479 file :file:`config.inc.php` (you can copy :file:`config.sample.inc.php` to get
480 a minimal configuration file) in the main (top-level) phpMyAdmin
481 directory (the one that contains :file:`index.php`). phpMyAdmin first
482 loads :file:`libraries/config.default.php` and then overrides those values
483 with anything found in :file:`config.inc.php`. If the default value is
484 okay for a particular setting, there is no need to include it in
485 :file:`config.inc.php`. You'll probably need only a few directives to get going; a
486 simple configuration may look like this:
488 .. code-block:: xml+php
492 // use here a value of your choice at least 32 chars long
493 $cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o';
497 $cfg['Servers'][$i]['auth_type'] = 'cookie';
498 // if you insist on "root" having no password:
499 // $cfg['Servers'][$i]['AllowNoPassword'] = true; `
502 Or, if you prefer to not be prompted every time you log in:
504 .. code-block:: xml+php
511 $cfg['Servers'][$i]['user'] = 'root';
512 $cfg['Servers'][$i]['password'] = 'cbb74bc'; // use here your password
513 $cfg['Servers'][$i]['auth_type'] = 'config';
518 Storing passwords in the configuration is insecure as anybody can then
519 manipulate with your database.
521 For a full explanation of possible configuration values, see the
522 :ref:`config` of this document.
524 .. index:: Setup script
531 Instead of manually editing :file:`config.inc.php`, you can use phpMyAdmin's
532 setup feature. The file can be generated using the setup and you can download it
533 for upload to the server.
535 Next, open your browser and visit the location where you installed phpMyAdmin,
536 with the ``/setup`` suffix. The changes are not saved to the server, you need to
537 use the :guilabel:`Download` button to save them to your computer and then upload
540 Now the file is ready to be used. You can choose to review or edit the
541 file with your favorite editor, if you prefer to set some advanced
542 options which the setup script does not provide.
544 #. If you are using the ``auth_type`` "config", it is suggested that you
545 protect the phpMyAdmin installation directory because using config
546 does not require a user to enter a password to access the phpMyAdmin
547 installation. Use of an alternate authentication method is
548 recommended, for example with HTTP–AUTH in a :term:`.htaccess` file or switch to using
549 ``auth_type`` cookie or http. See the :ref:`faqmultiuser`
550 for additional information, especially :ref:`faq4_4`.
551 #. Open the main phpMyAdmin directory in your browser.
552 phpMyAdmin should now display a welcome screen and your databases, or
553 a login dialog if using :term:`HTTP` or
554 cookie authentication mode.
558 Setup script on Debian, Ubuntu and derivatives
559 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
561 Debian and Ubuntu have changed way how setup is enabled and disabled, in a way
562 that single command has to be executed for either of these.
564 To allow editing configuration invoke:
568 /usr/sbin/pma-configure
570 To block editing configuration invoke:
576 Setup script on openSUSE
577 ~~~~~~~~~~~~~~~~~~~~~~~~
579 Some openSUSE releases do not include setup script in the package. In case you
580 want to generate configuration on these you can either download original
581 package from <https://www.phpmyadmin.net/> or use setup script on our demo
582 server: <https://demo.phpmyadmin.net/STABLE/setup/>.
587 Verifying phpMyAdmin releases
588 +++++++++++++++++++++++++++++
590 Since July 2015 all phpMyAdmin releases are cryptographically signed by the
591 releasing developer, who through January 2016 was Marc Delisle. His key id is
592 0xFEFC65D181AF644A, his PGP fingerprint is:
594 .. code-block:: console
596 436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A
598 and you can get more identification information from <https://keybase.io/lem9>.
600 Beginning in January 2016, the release manager is Isaac Bennetch. His key id is
601 0xCE752F178259BD92, and his PGP fingerprint is:
603 .. code-block:: console
605 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
607 and you can get more identification information from <https://keybase.io/ibennetch>.
609 Some additional downloads (for example themes) might be signed by Michal Čihař. His key id is
610 0x9C27B31342B7511D, and his PGP fingerprint is:
612 .. code-block:: console
614 63CB 1DF1 EF12 CF2A C0EE 5A32 9C27 B313 42B7 511D
616 and you can get more identification information from <https://keybase.io/nijel>.
618 You should verify that the signature matches the archive you have downloaded.
619 This way you can be sure that you are using the same code that was released.
620 You should also verify the date of the signature to make sure that you
621 downloaded the latest version.
623 Each archive is accompanied with ``.asc`` files which contains the PGP signature
624 for it. Once you have both of them in the same folder, you can verify the signature:
626 .. code-block:: console
628 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
629 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
630 gpg: Can't check signature: public key not found
632 As you can see gpg complains that it does not know the public key. At this
633 point you should do one of the following steps:
635 * Download the keyring from `our download server <https://files.phpmyadmin.net/phpmyadmin.keyring>`_, then import it with:
637 .. code-block:: console
639 $ gpg --import phpmyadmin.keyring
641 * Download and import the key from one of the key servers:
643 .. code-block:: console
645 $ gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
646 gpg: requesting key 8259BD92 from hkp server pgp.mit.edu
647 gpg: key 8259BD92: public key "Isaac Bennetch <bennetch@gmail.com>" imported
648 gpg: no ultimately trusted keys found
649 gpg: Total number processed: 1
650 gpg: imported: 1 (RSA: 1)
652 This will improve the situation a bit - at this point you can verify that the
653 signature from the given key is correct but you still can not trust the name used
656 .. code-block:: console
658 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
659 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
660 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>"
661 gpg: aka "Isaac Bennetch <isaac@bennetch.org>"
662 gpg: WARNING: This key is not certified with a trusted signature!
663 gpg: There is no indication that the signature belongs to the owner.
664 Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
666 The problem here is that anybody could issue the key with this name. You need to
667 ensure that the key is actually owned by the mentioned person. The GNU Privacy
668 Handbook covers this topic in the chapter `Validating other keys on your public
669 keyring`_. The most reliable method is to meet the developer in person and
670 exchange key fingerprints, however you can also rely on the web of trust. This way
671 you can trust the key transitively though signatures of others, who have met
672 the developer in person. For example you can see how `Isaac's key links to
675 Once the key is trusted, the warning will not occur:
677 .. code-block:: console
679 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
680 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
681 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>" [full]
683 Should the signature be invalid (the archive has been changed), you would get a
684 clear error regardless of the fact that the key is trusted or not:
686 .. code-block:: console
688 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
689 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
690 gpg: BAD signature from "Isaac Bennetch <bennetch@gmail.com>" [unknown]
692 .. _Validating other keys on your public keyring: https://www.gnupg.org/gph/en/manual.html#AEN335
694 .. _Isaac's key links to Linus's key: https://pgp.cs.uu.nl/paths/79be3e4300411886/to/ce752f178259bd92.html
697 single: Configuration storage
698 single: phpMyAdmin configuration storage
703 phpMyAdmin configuration storage
704 ++++++++++++++++++++++++++++++++
706 .. versionchanged:: 3.4.0
708 Prior to phpMyAdmin 3.4.0 this was called Linked Tables Infrastructure, but
709 the name was changed due to extended scope of the storage.
711 For a whole set of additional features (:ref:`bookmarks`, comments, :term:`SQL`-history,
712 tracking mechanism, :term:`PDF`-generation, :ref:`transformations`, :ref:`relations`
713 etc.) you need to create a set of special tables. Those tables can be located
714 in your own database, or in a central database for a multi-user installation
715 (this database would then be accessed by the controluser, so no other user
716 should have rights to it).
723 In many cases, this database structure can be automatically created and
724 configured. This is called “Zero Configuration” mode and can be particularly
725 useful in shared hosting situations. “Zeroconf” mode is on by default, to
726 disable set :config:option:`$cfg['ZeroConf']` to false.
728 The following three scenarios are covered by the Zero Configuration mode:
730 * When entering a database where the configuration storage tables are not
731 present, phpMyAdmin offers to create them from the Operations tab.
732 * When entering a database where the tables do already exist, the software
733 automatically detects this and begins using them. This is the most common
734 situation; after the tables are initially created automatically they are
735 continually used without disturbing the user; this is also most useful on
736 shared hosting where the user is not able to edit :file:`config.inc.php` and
737 usually the user only has access to one database.
738 * When having access to multiple databases, if the user first enters the
739 database containing the configuration storage tables then switches to
741 phpMyAdmin continues to use the tables from the first database; the user is
742 not prompted to create more tables in the new database.
748 Please look at your ``./sql/`` directory, where you should find a
749 file called *create\_tables.sql*. (If you are using a Windows server,
750 pay special attention to :ref:`faq1_23`).
752 If you already had this infrastructure and:
754 * upgraded to MySQL 4.1.2 or newer, please use
755 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
756 * upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (<= 4.2.x),
757 please use :file:`sql/upgrade_column_info_4_3_0+.sql`.
758 * upgraded to phpMyAdmin 4.7.0 or newer from 4.3.0 or newer,
759 please use :file:`sql/upgrade_tables_4_7_0+.sql`.
761 and then create new tables by importing :file:`sql/create_tables.sql`.
763 You can use your phpMyAdmin to create the tables for you. Please be
764 aware that you may need special (administrator) privileges to create
765 the database and tables, and that the script may need some tuning,
766 depending on the database name.
768 After having imported the :file:`sql/create_tables.sql` file, you
769 should specify the table names in your :file:`config.inc.php` file. The
770 directives used for that can be found in the :ref:`config`.
772 You will also need to have a controluser
773 (:config:option:`$cfg['Servers'][$i]['controluser']` and
774 :config:option:`$cfg['Servers'][$i]['controlpass']` settings)
775 with the proper rights to those tables. For example you can create it
776 using following statement:
778 .. code-block:: mysql
780 GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
784 Upgrading from an older version
785 +++++++++++++++++++++++++++++++
789 **Never** extract the new version over an existing installation of
790 phpMyAdmin, always first remove the old files keeping just the
793 This way you will not leave old no longer working code in the directory,
794 which can have severe security implications or can cause various breakages.
796 Simply copy :file:`config.inc.php` from your previous installation into
797 the newly unpacked one. Configuration files from old versions may
798 require some tweaking as some options have been changed or removed.
799 For compatibility with PHP 5.3 and later, remove a
800 ``set_magic_quotes_runtime(0);`` statement that you might find near
801 the end of your configuration file.
803 You should **not** copy :file:`libraries/config.default.php` over
804 :file:`config.inc.php` because the default configuration file is version-
807 The complete upgrade can be performed in few simple steps:
809 1. Download the latest phpMyAdmin version from <https://www.phpmyadmin.net/downloads/>.
810 2. Rename existing phpMyAdmin folder (for example to ``phpmyadmin-old``).
811 3. Unpack freshly donwloaded phpMyAdmin to desired location (for example ``phpmyadmin``).
812 4. Copy :file:`config.inc.php`` from old location (``phpmyadmin-old``) to new one (``phpmyadmin``).
813 5. Test that everything works properly.
814 6. Remove backup of previous version (``phpmyadmin-old``).
816 If you have upgraded your MySQL server from a version previous to 4.1.2 to
817 version 5.x or newer and if you use the phpMyAdmin configuration storage, you
818 should run the :term:`SQL` script found in
819 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
821 If you have upgraded your phpMyAdmin to 4.3.0 or newer from 2.5.0 or
822 newer (<= 4.2.x) and if you use the phpMyAdmin configuration storage, you
823 should run the :term:`SQL` script found in
824 :file:`sql/upgrade_column_info_4_3_0+.sql`.
826 Do not forget to clear the browser cache and to empty the old session by
827 logging out and logging in again.
829 .. index:: Authentication mode
831 .. _authentication_modes:
833 Using authentication modes
834 ++++++++++++++++++++++++++
836 :term:`HTTP` and cookie authentication modes are recommended in a **multi-user
837 environment** where you want to give users access to their own database and
838 don't want them to play around with others. Nevertheless be aware that MS
839 Internet Explorer seems to be really buggy about cookies, at least till version
840 6. Even in a **single-user environment**, you might prefer to use :term:`HTTP`
841 or cookie mode so that your user/password pair are not in clear in the
844 :term:`HTTP` and cookie authentication
845 modes are more secure: the MySQL login information does not need to be
846 set in the phpMyAdmin configuration file (except possibly for the
847 :config:option:`$cfg['Servers'][$i]['controluser']`).
848 However, keep in mind that the password travels in plain text, unless
849 you are using the HTTPS protocol. In cookie mode, the password is
850 stored, encrypted with the AES algorithm, in a temporary cookie.
852 Then each of the *true* users should be granted a set of privileges
853 on a set of particular databases. Normally you shouldn't give global
854 privileges to an ordinary user, unless you understand the impact of those
855 privileges (for example, you are creating a superuser).
856 For example, to grant the user *real_user* with all privileges on
857 the database *user_base*:
859 .. code-block:: mysql
861 GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real_password';
864 What the user may now do is controlled entirely by the MySQL user management
865 system. With HTTP or cookie authentication mode, you don't need to fill the
866 user/password fields inside the :config:option:`$cfg['Servers']`.
876 .. index:: pair: HTTP; Authentication mode
880 HTTP authentication mode
881 ------------------------
883 * Uses :term:`HTTP` Basic authentication
884 method and allows you to log in as any valid MySQL user.
885 * Is supported with most PHP configurations. For :term:`IIS` (:term:`ISAPI`)
886 support using :term:`CGI` PHP see :ref:`faq1_32`, for using with Apache
887 :term:`CGI` see :ref:`faq1_35`.
888 * When PHP is running under Apache's :term:`mod_proxy_fcgi` (e.g. with PHP-FPM),
889 ``Authorization`` headers are not passed to the underlying FCGI application,
890 such that your credentials will not reach the application. In this case, you can
891 add the following configuration directive:
893 .. code-block:: apache
895 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
897 * See also :ref:`faq4_4` about not using the :term:`.htaccess` mechanism along with
898 ':term:`HTTP`' authentication mode.
902 There is no way to do proper logout in HTTP authentication, most browsers
903 will remember credentials until there is no different successful
904 authentication. Because of this this method has limitation that you can not
905 login with same user after logout.
907 .. index:: pair: Cookie; Authentication mode
911 Cookie authentication mode
912 --------------------------
914 * Username and password are stored in cookies during the session and password
915 is deleted when it ends.
916 * With this mode, the user can truly log out of phpMyAdmin and log
917 back in with the same username (this is not possible with :ref:`auth_http`).
918 * If you want to allow users to enter any hostname to connect (rather than only
919 servers that are configured in :file:`config.inc.php`),
920 see the :config:option:`$cfg['AllowArbitraryServer']` directive.
921 * As mentioned in the :ref:`require` section, having the ``openssl`` extension
922 will speed up access considerably, but is not required.
924 .. index:: pair: Signon; Authentication mode
928 Signon authentication mode
929 --------------------------
931 * This mode is a convenient way of using credentials from another
932 application to authenticate to phpMyAdmin to implement single signon
934 * The other application has to store login information into session
935 data (see :config:option:`$cfg['Servers'][$i]['SignonSession']` and
936 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`) or you
937 need to implement script to return the credentials (see
938 :config:option:`$cfg['Servers'][$i]['SignonScript']`).
939 * When no credentials are available, the user is being redirected to
940 :config:option:`$cfg['Servers'][$i]['SignonURL']`, where you should handle
943 The very basic example of saving credentials in a session is available as
944 :file:`examples/signon.php`:
946 .. literalinclude:: ../examples/signon.php
949 Alternatively you can also use this way to integrate with OpenID as shown
950 in :file:`examples/openid.php`:
952 .. literalinclude:: ../examples/openid.php
955 If you intend to pass the credentials using some other means than, you have to
956 implement wrapper in PHP to get that data and set it to
957 :config:option:`$cfg['Servers'][$i]['SignonScript']`. There is very minimal example
958 in :file:`examples/signon-script.php`:
960 .. literalinclude:: ../examples/signon-script.php
964 :config:option:`$cfg['Servers'][$i]['auth_type']`,
965 :config:option:`$cfg['Servers'][$i]['SignonSession']`,
966 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`,
967 :config:option:`$cfg['Servers'][$i]['SignonScript']`,
968 :config:option:`$cfg['Servers'][$i]['SignonURL']`,
969 :ref:`example-signon`
972 .. index:: pair: Config; Authentication mode
976 Config authentication mode
977 --------------------------
979 * This mode is sometimes the less secure one because it requires you to fill the
980 :config:option:`$cfg['Servers'][$i]['user']` and
981 :config:option:`$cfg['Servers'][$i]['password']`
982 fields (and as a result, anyone who can read your :file:`config.inc.php`
983 can discover your username and password).
984 * In the :ref:`faqmultiuser` section, there is an entry explaining how
985 to protect your configuration file.
986 * For additional security in this mode, you may wish to consider the
987 Host authentication :config:option:`$cfg['Servers'][$i]['AllowDeny']['order']`
988 and :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` configuration directives.
989 * Unlike cookie and http, does not require a user to log in when first
990 loading the phpMyAdmin site. This is by design but could allow any
991 user to access your installation. Use of some restriction method is
992 suggested, perhaps a :term:`.htaccess` file with the HTTP-AUTH directive or disallowing
993 incoming HTTP requests at one’s router or firewall will suffice (both
994 of which are beyond the scope of this manual but easily searchable
1000 Securing your phpMyAdmin installation
1001 +++++++++++++++++++++++++++++++++++++
1003 The phpMyAdmin team tries hard to make the application secure, however there
1004 are always ways to make your installation more secure:
1006 * Follow our `Security announcements <https://www.phpmyadmin.net/security/>`_ and upgrade
1007 phpMyAdmin whenever new vulnerability is published.
1008 * Serve phpMyAdmin on HTTPS only. Preferably, you should use HSTS as well, so that
1009 you're protected from protocol downgrade attacks.
1010 * Ensure your PHP setup follows recommendations for production sites, for example
1011 `display_errors <https://secure.php.net/manual/en/errorfunc.configuration.php#ini.display-errors>`_
1013 * Remove the ``test`` directory from phpMyAdmin, unless you are developing and need test suite.
1014 * Remove the ``setup`` directory from phpMyAdmin, you will probably not
1015 use it after the initial setup.
1016 * Properly choose an authentication method - :ref:`cookie`
1017 is probably the best choice for shared hosting.
1018 * Deny access to auxiliary files in :file:`./libraries/` or
1019 :file:`./templates/` subfolders in your webserver configuration.
1020 Such configuration prevents from possible path exposure and cross side
1021 scripting vulnerabilities that might happen to be found in that code. For the
1022 Apache webserver, this is often accomplished with a :term:`.htaccess` file in
1024 * Deny access to temporary files, see :config:option:`$cfg['TempDir']` (if that
1025 is placed inside your web root, see also :ref:`web-dirs`.
1026 * It is generally a good idea to protect a public phpMyAdmin installation
1027 against access by robots as they usually can not do anything good there. You
1028 can do this using ``robots.txt`` file in root of your webserver or limit
1029 access by web server configuration, see :ref:`faq1_42`.
1030 * In case you don't want all MySQL users to be able to access
1031 phpMyAdmin, you can use :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` to limit them
1032 or :config:option:`$cfg['Servers'][$i]['AllowRoot']` to deny root user access.
1033 * Enable :ref:`2fa` for your account.
1034 * Consider hiding phpMyAdmin behind an authentication proxy, so that
1035 users need to authenticate prior to providing MySQL credentials
1036 to phpMyAdmin. You can achieve this by configuring your web server to request
1037 HTTP authentication. For example in Apache this can be done with:
1039 .. code-block:: apache
1042 AuthName "Restricted Access"
1043 AuthUserFile /usr/share/phpmyadmin/passwd
1046 Once you have changed the configuration, you need to create a list of users which
1047 can authenticate. This can be done using the :program:`htpasswd` utility:
1051 htpasswd -c /usr/share/phpmyadmin/passwd username
1053 * If you are afraid of automated attacks, enabling Captcha by
1054 :config:option:`$cfg['CaptchaLoginPublicKey']` and
1055 :config:option:`$cfg['CaptchaLoginPrivateKey']` might be an option.
1056 * Failed login attemps are logged to syslog (if available, see
1057 :config:option:`$cfg['AuthLog']`). This can allow using a tool such as
1058 fail2ban to block brute-force attempts. Note that the log file used by syslog
1059 is not the same as the Apache error or access log files.
1060 * In case you're running phpMyAdmin together with other PHP applications, it is
1061 generally advised to use separate session storage for phpMyAdmin to avoid
1062 possible session based attacks against it. You can use
1063 :config:option:`$cfg['SessionSavePath']` to achieve this.
1067 Using SSL for connection to database server
1068 +++++++++++++++++++++++++++++++++++++++++++
1070 It is recommended to use SSL when connecting to remote database server. There
1071 are several configuration options involved in the SSL setup:
1073 :config:option:`$cfg['Servers'][$i]['ssl']`
1074 Defines whether to use SSL at all. If you enable only this, the connection
1075 will be encrypted, but there is not authentication of the connection - you
1076 can not verify that you are talking to the right server.
1077 :config:option:`$cfg['Servers'][$i]['ssl_key']` and :config:option:`$cfg['Servers'][$i]['ssl_cert']`
1078 This is used for authentication of client to the server.
1079 :config:option:`$cfg['Servers'][$i]['ssl_ca']` and :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`
1080 The certificate authorities you trust for server certificates.
1081 This is used to ensure that you are talking to a trusted server.
1082 :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1083 This configuration disables server certificate verification. Use with
1088 :ref:`example-google-ssl`,
1089 :config:option:`$cfg['Servers'][$i]['ssl']`,
1090 :config:option:`$cfg['Servers'][$i]['ssl_key']`,
1091 :config:option:`$cfg['Servers'][$i]['ssl_cert']`,
1092 :config:option:`$cfg['Servers'][$i]['ssl_ca']`,
1093 :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`,
1094 :config:option:`$cfg['Servers'][$i]['ssl_ciphers']`,
1095 :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1100 Users with column-specific privileges are unable to "Browse"
1101 ------------------------------------------------------------
1103 If a user has only column-specific privileges on some (but not all) columns in a table, "Browse"
1104 will fail with an error message.
1106 As a workaround, a bookmarked query with the same name as the table can be created, this will
1107 run when using the "Browse" link instead. `Issue 11922 <https://github.com/phpmyadmin/phpmyadmin/issues/11922>`_.
1109 Trouble logging back in after logging out using 'http' authentication
1110 ----------------------------------------------------------------------
1112 When using the 'http' ``auth_type``, it can be impossible to log back in (when the logout comes
1113 manually or after a period of inactivity). `Issue 11898 <https://github.com/phpmyadmin/phpmyadmin/issues/11898>`_.
1116 .. _Composer tool: https://getcomposer.org/
1117 .. _Packagist: https://packagist.org/
1118 .. _Docker image: https://hub.docker.com/r/phpmyadmin/phpmyadmin/