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 a 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://salsa.debian.org/phpmyadmin-team/phpmyadmin/blob/master/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 Gentoo ships the phpMyAdmin package, both in a near-stock configuration as well
54 as in a ``webapp-config`` configuration. Use ``emerge dev-db/phpmyadmin`` to
60 Mandriva ships the phpMyAdmin package in their ``contrib`` branch and can be
61 installed via the usual Control Center.
66 Fedora ships the phpMyAdmin package, but be aware that the configuration file
67 is maintained in ``/etc/phpMyAdmin/`` and may differ in some ways from the
68 official phpMyAdmin documentation.
70 Red Hat Enterprise Linux
71 ------------------------
73 Red Hat Enterprise Linux itself and thus derivatives like CentOS don't
74 ship phpMyAdmin, but the Fedora-driven repository
75 `Extra Packages for Enterprise Linux (EPEL) <https://fedoraproject.org/wiki/EPEL>`_
77 `enabled <https://fedoraproject.org/wiki/EPEL/FAQ#howtouse>`_.
78 But be aware that the configuration file is maintained in
79 ``/etc/phpMyAdmin/`` and may differ in some ways from the
80 official phpMyAdmin documentation.
85 The easiest way to get phpMyAdmin on Windows is using third party products
86 which include phpMyAdmin together with a database and web server such as
87 `XAMPP <https://www.apachefriends.org/index.html>`_.
89 You can find more of such options at `Wikipedia <https://en.wikipedia.org/wiki/List_of_AMP_packages>`_.
94 You can clone current phpMyAdmin source from
95 ``https://github.com/phpmyadmin/phpmyadmin.git``:
99 git clone https://github.com/phpmyadmin/phpmyadmin.git
101 Additionally you need to install dependencies using the `Composer tool`_:
107 If you do not intend to develop, you can skip the installation of developer tools
112 composer update --no-dev
116 Installing using Composer
117 +++++++++++++++++++++++++
119 You can install phpMyAdmin using the `Composer tool`_, since 4.7.0 the releases
120 are automatically mirrored to the default `Packagist`_ repository.
124 The content of the Composer repository is automatically generated
125 separately from the releases, so the content doesn't have to be
126 100% same as when you download the tarball. There should be no
127 functional differences though.
129 To install phpMyAdmin simply run:
133 composer create-project phpmyadmin/phpmyadmin
135 Alternatively you can use our own composer repository, which contains
136 the release tarballs and is available at
137 <https://www.phpmyadmin.net/packages.json>:
141 composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
145 Installing using Docker
146 +++++++++++++++++++++++
148 phpMyAdmin comes with a `Docker image`_, which you can easily deploy. You can
153 docker pull phpmyadmin/phpmyadmin
155 The phpMyAdmin server will listen on port 80. It supports several ways of
156 configuring the link to the database server, either by Docker's link feature
157 by linking your database container to ``db`` for phpMyAdmin (by specifying
158 ``--link your_db_host:db``) or by environment variables (in this case it's up
159 to you to set up networking in Docker to allow the phpMyAdmin container to access
160 the database container over the network).
164 Docker environment variables
165 ----------------------------
167 You can configure several phpMyAdmin features using environment variables:
169 .. envvar:: PMA_ARBITRARY
171 Allows you to enter a database server hostname on login form.
173 .. seealso:: :config:option:`$cfg['AllowArbitraryServer']`
177 Hostname or IP address of the database server to use.
179 .. seealso:: :config:option:`$cfg['Servers'][$i]['host']`
181 .. envvar:: PMA_HOSTS
183 Comma-separated hostnames or IP addresses of the database servers to use.
185 .. note:: Used only if :envvar:`PMA_HOST` is empty.
187 .. envvar:: PMA_VERBOSE
189 Verbose name of the database server.
191 .. seealso:: :config:option:`$cfg['Servers'][$i]['verbose']`
193 .. envvar:: PMA_VERBOSES
195 Comma-separated verbose name of the database servers.
197 .. note:: Used only if :envvar:`PMA_VERBOSE` is empty.
201 User name to use for :ref:`auth_config`.
203 .. envvar:: PMA_PASSWORD
205 Password to use for :ref:`auth_config`.
209 Port of the database server to use.
211 .. envvar:: PMA_PORTS
213 Comma-separated ports of the database server to use.
215 .. note:: Used only if :envvar:`PMA_PORT` is empty.
217 .. envvar:: PMA_ABSOLUTE_URI
219 The fully-qualified path (``https://pma.example.net/``) where the reverse
220 proxy makes phpMyAdmin available.
222 .. seealso:: :config:option:`$cfg['PmaAbsoluteUri']`
224 By default, :ref:`cookie` is used, but if :envvar:`PMA_USER` and
225 :envvar:`PMA_PASSWORD` are set, it is switched to :ref:`auth_config`.
229 The credentials you need to log in are stored in the MySQL server, in case
230 of Docker image, there are various ways to set it (for example
231 :samp:`MYSQL_ROOT_PASSWORD` when starting the MySQL container). Please check
232 documentation for `MariaDB container <https://hub.docker.com/_/mariadb>`_
233 or `MySQL container <https://hub.docker.com/_/mysql>`_.
237 Customizing configuration
238 -------------------------
240 Additionally configuration can be tweaked by :file:`/etc/phpmyadmin/config.user.inc.php`. If
241 this file exists, it will be loaded after configuration is generated from above
242 environment variables, so you can override any configuration variable. This
243 configuration can be added as a volume when invoking docker using
244 `-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php` parameters.
246 Note that the supplied configuration file is applied after :ref:`docker-vars`,
247 but you can override any of the values.
249 For example to change the default behavior of CSV export you can use the following
255 $cfg['Export']['csv_columns'] = true;
258 You can also use it to define server configuration instead of using the
259 environment variables listed in :ref:`docker-vars`:
264 /* Override Servers array */
267 'auth_type' => 'cookie',
270 'verbose' => 'Verbose name 1',
273 'auth_type' => 'cookie',
276 'verbose' => 'Verbose name 2',
282 See :ref:`config` for detailed description of configuration options.
287 You can use the following volumes to customize image behavior:
289 :file:`/etc/phpmyadmin/config.user.inc.php`
291 Can be used for additional settings, see the previous chapter for more details.
295 Directory where PHP sessions are stored. You might want to share this
296 for example when using :ref:`auth_signon`.
300 Directory where phpMyAdmin looks for themes. By default only those shipped
301 with phpMyAdmin are included, but you can include additional phpMyAdmin
302 themes (see :ref:`themes`) by using Docker volumes.
307 To connect phpMyAdmin to a given server use:
311 docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
313 To connect phpMyAdmin to more servers use:
317 docker run --name myadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80 phpmyadmin/phpmyadmin
319 To use arbitrary server option:
323 docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
325 You can also link the database container using Docker:
329 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin/phpmyadmin
331 Running with additional configuration:
335 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
337 Running with additional themes:
341 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /custom/phpmyadmin/theme/:/www/themes/theme/ phpmyadmin/phpmyadmin
346 Alternatively, you can also use docker-compose with the docker-compose.yml from
347 <https://github.com/phpmyadmin/docker>. This will run phpMyAdmin with an
348 arbitrary server - allowing you to specify MySQL/MariaDB server on the login page.
354 Customizing configuration file using docker-compose
355 ---------------------------------------------------
357 You can use an external file to customize phpMyAdmin configuration and pass it
358 using the volumes directive:
363 image: phpmyadmin/phpmyadmin
364 container_name: phpmyadmin
372 - ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
373 - /custom/phpmyadmin/theme/:/www/themes/theme/
375 .. seealso:: :ref:`docker-custom`
377 Running behind haproxy in a subdirectory
378 ----------------------------------------
380 When you want to expose phpMyAdmin running in a Docker container in a
381 subdirectory, you need to rewrite the request path in the server proxying the
384 For example, using haproxy it can be done as:
391 option http-server-close
393 ### NETWORK restriction
394 acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
397 acl phpmyadmin path_dir /phpmyadmin
398 use_backend phpmyadmin if phpmyadmin LOCALNET
403 reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
405 # phpMyAdmin container IP
406 server localhost 172.30.21.21:80
408 When using traefik, something like following should work:
412 defaultEntryPoints = ["http"]
416 [entryPoints.http.redirect]
417 regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
422 [backends.myadmin.servers.myadmin]
423 url="http://internal.address.to.pma"
428 passHostHeader = true
429 [frontends.myadmin.routes.default]
430 rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
432 You then should specify :envvar:`PMA_ABSOLUTE_URI` in the docker-compose
442 image: phpmyadmin/phpmyadmin
443 container_name: phpmyadmin
445 domainname: example.com
449 - PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
450 - PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
453 - PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
460 #. Choose an appropriate distribution kit from the phpmyadmin.net
461 Downloads page. Some kits contain only the English messages, others
462 contain all languages. We'll assume you chose a kit whose name
463 looks like ``phpMyAdmin-x.x.x -all-languages.tar.gz``.
464 #. Ensure you have downloaded a genuine archive, see :ref:`verify`.
465 #. Untar or unzip the distribution (be sure to unzip the subdirectories):
466 ``tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz`` in your
467 webserver's document root. If you don't have direct access to your
468 document root, put the files in a directory on your local machine,
469 and, after step 4, transfer the directory on your web server using,
471 #. Ensure that all the scripts have the appropriate owner (if PHP is
472 running in safe mode, having some scripts with an owner different from
473 the owner of other scripts will be a problem). See :ref:`faq4_2` and
474 :ref:`faq1_26` for suggestions.
475 #. Now you must configure your installation. There are two methods that
476 can be used. Traditionally, users have hand-edited a copy of
477 :file:`config.inc.php`, but now a wizard-style setup script is provided
478 for those who prefer a graphical installation. Creating a
479 :file:`config.inc.php` is still a quick way to get started and needed for
480 some advanced features.
482 Manually creating the file
483 --------------------------
485 To manually create the file, simply use your text editor to create the
486 file :file:`config.inc.php` (you can copy :file:`config.sample.inc.php` to get
487 a minimal configuration file) in the main (top-level) phpMyAdmin
488 directory (the one that contains :file:`index.php`). phpMyAdmin first
489 loads :file:`libraries/config.default.php` and then overrides those values
490 with anything found in :file:`config.inc.php`. If the default value is
491 okay for a particular setting, there is no need to include it in
492 :file:`config.inc.php`. You'll probably need only a few directives to get going; a
493 simple configuration may look like this:
495 .. code-block:: xml+php
498 // use here a value of your choice at least 32 chars long
499 $cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o';
503 $cfg['Servers'][$i]['auth_type'] = 'cookie';
504 // if you insist on "root" having no password:
505 // $cfg['Servers'][$i]['AllowNoPassword'] = true; `
508 Or, if you prefer to not be prompted every time you log in:
510 .. code-block:: xml+php
516 $cfg['Servers'][$i]['user'] = 'root';
517 $cfg['Servers'][$i]['password'] = 'cbb74bc'; // use here your password
518 $cfg['Servers'][$i]['auth_type'] = 'config';
523 Storing passwords in the configuration is insecure as anybody can then
524 manipulate your database.
526 For a full explanation of possible configuration values, see the
527 :ref:`config` of this document.
529 .. index:: Setup script
533 Using the Setup script
534 ----------------------
536 Instead of manually editing :file:`config.inc.php`, you can use phpMyAdmin's
537 setup feature. The file can be generated using the setup and you can download it
538 for upload to the server.
540 Next, open your browser and visit the location where you installed phpMyAdmin,
541 with the ``/setup`` suffix. The changes are not saved to the server, you need to
542 use the :guilabel:`Download` button to save them to your computer and then upload
545 Now the file is ready to be used. You can choose to review or edit the
546 file with your favorite editor, if you prefer to set some advanced
547 options that the setup script does not provide.
549 #. If you are using the ``auth_type`` "config", it is suggested that you
550 protect the phpMyAdmin installation directory because using config
551 does not require a user to enter a password to access the phpMyAdmin
552 installation. Use of an alternate authentication method is
553 recommended, for example with HTTP–AUTH in a :term:`.htaccess` file or switch to using
554 ``auth_type`` cookie or http. See the :ref:`faqmultiuser`
555 for additional information, especially :ref:`faq4_4`.
556 #. Open the main phpMyAdmin directory in your browser.
557 phpMyAdmin should now display a welcome screen and your databases, or
558 a login dialog if using :term:`HTTP` or
559 cookie authentication mode.
563 Setup script on Debian, Ubuntu and derivatives
564 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
566 Debian and Ubuntu have changed the way in which the setup script is enabled and disabled, in a way
567 that single command has to be executed for either of these.
569 To allow editing configuration invoke:
573 /usr/sbin/pma-configure
575 To block editing configuration invoke:
581 Setup script on openSUSE
582 ~~~~~~~~~~~~~~~~~~~~~~~~
584 Some openSUSE releases do not include setup script in the package. In case you
585 want to generate configuration on these you can either download original
586 package from <https://www.phpmyadmin.net/> or use setup script on our demo
587 server: <https://demo.phpmyadmin.net/master/setup/>.
591 Verifying phpMyAdmin releases
592 +++++++++++++++++++++++++++++
594 Since July 2015 all phpMyAdmin releases are cryptographically signed by the
595 releasing developer, who through January 2016 was Marc Delisle. His key id is
596 0xFEFC65D181AF644A, his PGP fingerprint is:
598 .. code-block:: console
600 436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A
602 and you can get more identification information from <https://keybase.io/lem9>.
604 Beginning in January 2016, the release manager is Isaac Bennetch. His key id is
605 0xCE752F178259BD92, and his PGP fingerprint is:
607 .. code-block:: console
609 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
611 and you can get more identification information from <https://keybase.io/ibennetch>.
613 Some additional downloads (for example themes) might be signed by Michal Čihař. His key id is
614 0x9C27B31342B7511D, and his PGP fingerprint is:
616 .. code-block:: console
618 63CB 1DF1 EF12 CF2A C0EE 5A32 9C27 B313 42B7 511D
620 and you can get more identification information from <https://keybase.io/nijel>.
622 You should verify that the signature matches the archive you have downloaded.
623 This way you can be sure that you are using the same code that was released.
624 You should also verify the date of the signature to make sure that you
625 downloaded the latest version.
627 Each archive is accompanied by ``.asc`` files which contain the PGP signature
628 for it. Once you have both of them in the same folder, you can verify the signature:
630 .. code-block:: console
632 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
633 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
634 gpg: Can't check signature: public key not found
636 As you can see gpg complains that it does not know the public key. At this
637 point, you should do one of the following steps:
639 * Download the keyring from `our download server <https://files.phpmyadmin.net/phpmyadmin.keyring>`_, then import it with:
641 .. code-block:: console
643 $ gpg --import phpmyadmin.keyring
645 * Download and import the key from one of the key servers:
647 .. code-block:: console
649 $ gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
650 gpg: requesting key 8259BD92 from hkp server pgp.mit.edu
651 gpg: key 8259BD92: public key "Isaac Bennetch <bennetch@gmail.com>" imported
652 gpg: no ultimately trusted keys found
653 gpg: Total number processed: 1
654 gpg: imported: 1 (RSA: 1)
656 This will improve the situation a bit - at this point, you can verify that the
657 signature from the given key is correct but you still can not trust the name used
660 .. code-block:: console
662 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
663 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
664 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>"
665 gpg: aka "Isaac Bennetch <isaac@bennetch.org>"
666 gpg: WARNING: This key is not certified with a trusted signature!
667 gpg: There is no indication that the signature belongs to the owner.
668 Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
670 The problem here is that anybody could issue the key with this name. You need to
671 ensure that the key is actually owned by the mentioned person. The GNU Privacy
672 Handbook covers this topic in the chapter `Validating other keys on your public
673 keyring`_. The most reliable method is to meet the developer in person and
674 exchange key fingerprints, however, you can also rely on the web of trust. This way
675 you can trust the key transitively though signatures of others, who have met
676 the developer in person. For example, you can see how `Isaac's key links to
679 Once the key is trusted, the warning will not occur:
681 .. code-block:: console
683 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
684 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
685 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>" [full]
687 Should the signature be invalid (the archive has been changed), you would get a
688 clear error regardless of the fact that the key is trusted or not:
690 .. code-block:: console
692 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
693 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
694 gpg: BAD signature from "Isaac Bennetch <bennetch@gmail.com>" [unknown]
696 .. _Validating other keys on your public keyring: https://www.gnupg.org/gph/en/manual.html#AEN335
698 .. _Isaac's key links to Linus's key: https://pgp.cs.uu.nl/paths/79be3e4300411886/to/ce752f178259bd92.html
701 single: Configuration storage
702 single: phpMyAdmin configuration storage
707 phpMyAdmin configuration storage
708 ++++++++++++++++++++++++++++++++
710 .. versionchanged:: 3.4.0
712 Prior to phpMyAdmin 3.4.0 this was called Linked Tables Infrastructure, but
713 the name was changed due to the extended scope of the storage.
715 For a whole set of additional features (:ref:`bookmarks`, comments, :term:`SQL`-history,
716 tracking mechanism, :term:`PDF`-generation, :ref:`transformations`, :ref:`relations`
717 etc.) you need to create a set of special tables. Those tables can be located
718 in your own database, or in a central database for a multi-user installation
719 (this database would then be accessed by the controluser, so no other user
720 should have rights to it).
727 In many cases, this database structure can be automatically created and
728 configured. This is called “Zero Configuration” mode and can be particularly
729 useful in shared hosting situations. “Zeroconf” mode is on by default, to
730 disable set :config:option:`$cfg['ZeroConf']` to false.
732 The following three scenarios are covered by the Zero Configuration mode:
734 * When entering a database where the configuration storage tables are not
735 present, phpMyAdmin offers to create them from the Operations tab.
736 * When entering a database where the tables do already exist, the software
737 automatically detects this and begins using them. This is the most common
738 situation; after the tables are initially created automatically they are
739 continually used without disturbing the user; this is also most useful on
740 shared hosting where the user is not able to edit :file:`config.inc.php` and
741 usually the user only has access to one database.
742 * When having access to multiple databases, if the user first enters the
743 database containing the configuration storage tables then switches to
745 phpMyAdmin continues to use the tables from the first database; the user is
746 not prompted to create more tables in the new database.
751 Please look at your ``./sql/`` directory, where you should find a
752 file called *create\_tables.sql*. (If you are using a Windows server,
753 pay special attention to :ref:`faq1_23`).
755 If you already had this infrastructure and:
757 * upgraded to MySQL 4.1.2 or newer, please use
758 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
759 * upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (<= 4.2.x),
760 please use :file:`sql/upgrade_column_info_4_3_0+.sql`.
761 * upgraded to phpMyAdmin 4.7.0 or newer from 4.3.0 or newer,
762 please use :file:`sql/upgrade_tables_4_7_0+.sql`.
764 and then create new tables by importing :file:`sql/create_tables.sql`.
766 You can use your phpMyAdmin to create the tables for you. Please be
767 aware that you may need special (administrator) privileges to create
768 the database and tables, and that the script may need some tuning,
769 depending on the database name.
771 After having imported the :file:`sql/create_tables.sql` file, you
772 should specify the table names in your :file:`config.inc.php` file. The
773 directives used for that can be found in the :ref:`config`.
775 You will also need to have a controluser
776 (:config:option:`$cfg['Servers'][$i]['controluser']` and
777 :config:option:`$cfg['Servers'][$i]['controlpass']` settings)
778 with the proper rights to those tables. For example you can create it
779 using following statement:
781 .. code-block:: mysql
783 GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
787 Upgrading from an older version
788 +++++++++++++++++++++++++++++++
792 **Never** extract the new version over an existing installation of
793 phpMyAdmin, always first remove the old files keeping just the
796 This way, you will not leave any old or outdated files in the directory,
797 which can have severe security implications or can cause various breakages.
799 Simply copy :file:`config.inc.php` from your previous installation into
800 the newly unpacked one. Configuration files from old versions may
801 require some tweaking as some options have been changed or removed.
802 For compatibility with PHP 5.3 and later, remove a
803 ``set_magic_quotes_runtime(0);`` statement that you might find near
804 the end of your configuration file.
806 You should **not** copy :file:`libraries/config.default.php` over
807 :file:`config.inc.php` because the default configuration file is version-
810 The complete upgrade can be performed in a few simple steps:
812 1. Download the latest phpMyAdmin version from <https://www.phpmyadmin.net/downloads/>.
813 2. Rename existing phpMyAdmin folder (for example to ``phpmyadmin-old``).
814 3. Unpack freshly downloaded phpMyAdmin to the desired location (for example ``phpmyadmin``).
815 4. Copy :file:`config.inc.php`` from old location (``phpmyadmin-old``) to the new one (``phpmyadmin``).
816 5. Test that everything works properly.
817 6. Remove backup of a previous version (``phpmyadmin-old``).
819 If you have upgraded your MySQL server from a version previous to 4.1.2 to
820 version 5.x or newer and if you use the phpMyAdmin configuration storage, you
821 should run the :term:`SQL` script found in
822 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
824 If you have upgraded your phpMyAdmin to 4.3.0 or newer from 2.5.0 or
825 newer (<= 4.2.x) and if you use the phpMyAdmin configuration storage, you
826 should run the :term:`SQL` script found in
827 :file:`sql/upgrade_column_info_4_3_0+.sql`.
829 Do not forget to clear the browser cache and to empty the old session by
830 logging out and logging in again.
832 .. index:: Authentication mode
834 .. _authentication_modes:
836 Using authentication modes
837 ++++++++++++++++++++++++++
839 :term:`HTTP` and cookie authentication modes are recommended in a **multi-user
840 environment** where you want to give users access to their own database and
841 don't want them to play around with others. Nevertheless, be aware that MS
842 Internet Explorer seems to be really buggy about cookies, at least till version
843 6. Even in a **single-user environment**, you might prefer to use :term:`HTTP`
844 or cookie mode so that your user/password pair are not in clear in the
847 :term:`HTTP` and cookie authentication
848 modes are more secure: the MySQL login information does not need to be
849 set in the phpMyAdmin configuration file (except possibly for the
850 :config:option:`$cfg['Servers'][$i]['controluser']`).
851 However, keep in mind that the password travels in plain text unless
852 you are using the HTTPS protocol. In cookie mode, the password is
853 stored, encrypted with the AES algorithm, in a temporary cookie.
855 Then each of the *true* users should be granted a set of privileges
856 on a set of particular databases. Normally you shouldn't give global
857 privileges to an ordinary user unless you understand the impact of those
858 privileges (for example, you are creating a superuser).
859 For example, to grant the user *real_user* with all privileges on
860 the database *user_base*:
862 .. code-block:: mysql
864 GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real_password';
866 What the user may now do is controlled entirely by the MySQL user management
867 system. With HTTP or cookie authentication mode, you don't need to fill the
868 user/password fields inside the :config:option:`$cfg['Servers']`.
878 .. index:: pair: HTTP; Authentication mode
882 HTTP authentication mode
883 ------------------------
885 * Uses :term:`HTTP` Basic authentication
886 method and allows you to log in as any valid MySQL user.
887 * Is supported with most PHP configurations. For :term:`IIS` (:term:`ISAPI`)
888 support using :term:`CGI` PHP see :ref:`faq1_32`, for using with Apache
889 :term:`CGI` see :ref:`faq1_35`.
890 * When PHP is running under Apache's :term:`mod_proxy_fcgi` (e.g. with PHP-FPM),
891 ``Authorization`` headers are not passed to the underlying FCGI application,
892 such that your credentials will not reach the application. In this case, you can
893 add the following configuration directive:
895 .. code-block:: apache
897 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
899 * See also :ref:`faq4_4` about not using the :term:`.htaccess` mechanism along with
900 ':term:`HTTP`' authentication mode.
904 There is no way to do proper logout in HTTP authentication, most browsers
905 will remember credentials until there is no different successful
906 authentication. Because of this, this method has a limitation that you can not
907 login with the same user after logout.
909 .. index:: pair: Cookie; Authentication mode
913 Cookie authentication mode
914 --------------------------
916 * Username and password are stored in cookies during the session and password
917 is deleted when it ends.
918 * With this mode, the user can truly log out of phpMyAdmin and log
919 back in with the same username (this is not possible with :ref:`auth_http`).
920 * If you want to allow users to enter any hostname to connect (rather than only
921 servers that are configured in :file:`config.inc.php`),
922 see the :config:option:`$cfg['AllowArbitraryServer']` directive.
923 * As mentioned in the :ref:`require` section, having the ``openssl`` extension
924 will speed up access considerably, but is not required.
926 .. index:: pair: Signon; Authentication mode
930 Signon authentication mode
931 --------------------------
933 * This mode is a convenient way of using credentials from another
934 application to authenticate to phpMyAdmin to implement a single signon
936 * The other application has to store login information into session
937 data (see :config:option:`$cfg['Servers'][$i]['SignonSession']` and
938 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`) or you
939 need to implement script to return the credentials (see
940 :config:option:`$cfg['Servers'][$i]['SignonScript']`).
941 * When no credentials are available, the user is being redirected to
942 :config:option:`$cfg['Servers'][$i]['SignonURL']`, where you should handle
945 The very basic example of saving credentials in a session is available as
946 :file:`examples/signon.php`:
948 .. literalinclude:: ../examples/signon.php
951 Alternatively, you can also use this way to integrate with OpenID as shown
952 in :file:`examples/openid.php`:
954 .. literalinclude:: ../examples/openid.php
957 If you intend to pass the credentials using some other means than, you have to
958 implement wrapper in PHP to get that data and set it to
959 :config:option:`$cfg['Servers'][$i]['SignonScript']`. There is a very minimal example
960 in :file:`examples/signon-script.php`:
962 .. literalinclude:: ../examples/signon-script.php
966 :config:option:`$cfg['Servers'][$i]['auth_type']`,
967 :config:option:`$cfg['Servers'][$i]['SignonSession']`,
968 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`,
969 :config:option:`$cfg['Servers'][$i]['SignonScript']`,
970 :config:option:`$cfg['Servers'][$i]['SignonURL']`,
971 :ref:`example-signon`
973 .. index:: pair: Config; Authentication mode
977 Config authentication mode
978 --------------------------
980 * This mode is sometimes the less secure one because it requires you to fill the
981 :config:option:`$cfg['Servers'][$i]['user']` and
982 :config:option:`$cfg['Servers'][$i]['password']`
983 fields (and as a result, anyone who can read your :file:`config.inc.php`
984 can discover your username and password).
985 * In the :ref:`faqmultiuser` section, there is an entry explaining how
986 to protect your configuration file.
987 * For additional security in this mode, you may wish to consider the
988 Host authentication :config:option:`$cfg['Servers'][$i]['AllowDeny']['order']`
989 and :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` configuration directives.
990 * Unlike cookie and http, does not require a user to log in when first
991 loading the phpMyAdmin site. This is by design but could allow any
992 user to access your installation. Use of some restriction method is
993 suggested, perhaps a :term:`.htaccess` file with the HTTP-AUTH directive or disallowing
994 incoming HTTP requests at one’s router or firewall will suffice (both
995 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 a 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 the 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>`_.
1115 .. _Composer tool: https://getcomposer.org/
1116 .. _Packagist: https://packagist.org/
1117 .. _Docker image: https://hub.docker.com/r/phpmyadmin/phpmyadmin/