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 In order to install from Git, you'll need a few supporting applications:
96 * `Git <https://git-scm.com/downloads>`_ to download the source, or you can download the most recent source directly from `Github <https://codeload.github.com/phpmyadmin/phpmyadmin/zip/master>`_
97 * `Composer <https://getcomposer.org/download/>`__
98 * `Node.js <https://nodejs.org/en/download/>`_ (version 10 or higher)
99 * `Yarn <https://classic.yarnpkg.com/en/docs/install>`_
101 You can clone current phpMyAdmin source from
102 ``https://github.com/phpmyadmin/phpmyadmin.git``:
106 git clone https://github.com/phpmyadmin/phpmyadmin.git
108 Additionally you need to install dependencies using `Composer <https://getcomposer.org>`__:
114 If you do not intend to develop, you can skip the installation of developer tools
119 composer update --no-dev
121 Finally, you'll need to use `Yarn`_ to install some JavaScript dependencies:
129 Installing using Composer
130 +++++++++++++++++++++++++
132 You can install phpMyAdmin using the `Composer tool`_, since 4.7.0 the releases
133 are automatically mirrored to the default `Packagist`_ repository.
137 The content of the Composer repository is automatically generated
138 separately from the releases, so the content doesn't have to be
139 100% same as when you download the tarball. There should be no
140 functional differences though.
142 To install phpMyAdmin simply run:
146 composer create-project phpmyadmin/phpmyadmin
148 Alternatively you can use our own composer repository, which contains
149 the release tarballs and is available at
150 <https://www.phpmyadmin.net/packages.json>:
154 composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
158 Installing using Docker
159 +++++++++++++++++++++++
161 phpMyAdmin comes with a `Docker image`_, which you can easily deploy. You can
166 docker pull phpmyadmin/phpmyadmin
168 The phpMyAdmin server will listen on port 80. It supports several ways of
169 configuring the link to the database server, either by Docker's link feature
170 by linking your database container to ``db`` for phpMyAdmin (by specifying
171 ``--link your_db_host:db``) or by environment variables (in this case it's up
172 to you to set up networking in Docker to allow the phpMyAdmin container to access
173 the database container over the network).
177 Docker environment variables
178 ----------------------------
180 You can configure several phpMyAdmin features using environment variables:
182 .. envvar:: PMA_ARBITRARY
184 Allows you to enter a database server hostname on login form.
186 .. seealso:: :config:option:`$cfg['AllowArbitraryServer']`
190 Hostname or IP address of the database server to use.
192 .. seealso:: :config:option:`$cfg['Servers'][$i]['host']`
194 .. envvar:: PMA_HOSTS
196 Comma-separated hostnames or IP addresses of the database servers to use.
198 .. note:: Used only if :envvar:`PMA_HOST` is empty.
200 .. envvar:: PMA_VERBOSE
202 Verbose name of the database server.
204 .. seealso:: :config:option:`$cfg['Servers'][$i]['verbose']`
206 .. envvar:: PMA_VERBOSES
208 Comma-separated verbose name of the database servers.
210 .. note:: Used only if :envvar:`PMA_VERBOSE` is empty.
214 User name to use for :ref:`auth_config`.
216 .. envvar:: PMA_PASSWORD
218 Password to use for :ref:`auth_config`.
222 Port of the database server to use.
224 .. envvar:: PMA_PORTS
226 Comma-separated ports of the database server to use.
228 .. note:: Used only if :envvar:`PMA_PORT` is empty.
230 .. envvar:: PMA_ABSOLUTE_URI
232 The fully-qualified path (``https://pma.example.net/``) where the reverse
233 proxy makes phpMyAdmin available.
235 .. seealso:: :config:option:`$cfg['PmaAbsoluteUri']`
237 By default, :ref:`cookie` is used, but if :envvar:`PMA_USER` and
238 :envvar:`PMA_PASSWORD` are set, it is switched to :ref:`auth_config`.
242 The credentials you need to log in are stored in the MySQL server, in case
243 of Docker image, there are various ways to set it (for example
244 :samp:`MYSQL_ROOT_PASSWORD` when starting the MySQL container). Please check
245 documentation for `MariaDB container <https://hub.docker.com/_/mariadb>`_
246 or `MySQL container <https://hub.docker.com/_/mysql>`_.
250 Customizing configuration
251 -------------------------
253 Additionally configuration can be tweaked by :file:`/etc/phpmyadmin/config.user.inc.php`. If
254 this file exists, it will be loaded after configuration is generated from above
255 environment variables, so you can override any configuration variable. This
256 configuration can be added as a volume when invoking docker using
257 `-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php` parameters.
259 Note that the supplied configuration file is applied after :ref:`docker-vars`,
260 but you can override any of the values.
262 For example to change the default behavior of CSV export you can use the following
268 $cfg['Export']['csv_columns'] = true;
270 You can also use it to define server configuration instead of using the
271 environment variables listed in :ref:`docker-vars`:
276 /* Override Servers array */
279 'auth_type' => 'cookie',
282 'verbose' => 'Verbose name 1',
285 'auth_type' => 'cookie',
288 'verbose' => 'Verbose name 2',
294 See :ref:`config` for detailed description of configuration options.
299 You can use the following volumes to customize image behavior:
301 :file:`/etc/phpmyadmin/config.user.inc.php`
303 Can be used for additional settings, see the previous chapter for more details.
307 Directory where PHP sessions are stored. You might want to share this
308 for example when using :ref:`auth_signon`.
312 Directory where phpMyAdmin looks for themes. By default only those shipped
313 with phpMyAdmin are included, but you can include additional phpMyAdmin
314 themes (see :ref:`themes`) by using Docker volumes.
319 To connect phpMyAdmin to a given server use:
323 docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
325 To connect phpMyAdmin to more servers use:
329 docker run --name myadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80 phpmyadmin/phpmyadmin
331 To use arbitrary server option:
335 docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
337 You can also link the database container using Docker:
341 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin/phpmyadmin
343 Running with additional configuration:
347 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
349 Running with additional themes:
353 docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /custom/phpmyadmin/theme/:/www/themes/theme/ phpmyadmin/phpmyadmin
358 Alternatively, you can also use docker-compose with the docker-compose.yml from
359 <https://github.com/phpmyadmin/docker>. This will run phpMyAdmin with an
360 arbitrary server - allowing you to specify MySQL/MariaDB server on the login page.
366 Customizing configuration file using docker-compose
367 ---------------------------------------------------
369 You can use an external file to customize phpMyAdmin configuration and pass it
370 using the volumes directive:
375 image: phpmyadmin/phpmyadmin
376 container_name: phpmyadmin
384 - ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
385 - /custom/phpmyadmin/theme/:/www/themes/theme/
387 .. seealso:: :ref:`docker-custom`
389 Running behind haproxy in a subdirectory
390 ----------------------------------------
392 When you want to expose phpMyAdmin running in a Docker container in a
393 subdirectory, you need to rewrite the request path in the server proxying the
396 For example, using haproxy it can be done as:
403 option http-server-close
405 ### NETWORK restriction
406 acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
409 acl phpmyadmin path_dir /phpmyadmin
410 use_backend phpmyadmin if phpmyadmin LOCALNET
415 reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
417 # phpMyAdmin container IP
418 server localhost 172.30.21.21:80
420 When using traefik, something like following should work:
424 defaultEntryPoints = ["http"]
428 [entryPoints.http.redirect]
429 regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
434 [backends.myadmin.servers.myadmin]
435 url="http://internal.address.to.pma"
440 passHostHeader = true
441 [frontends.myadmin.routes.default]
442 rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
444 You then should specify :envvar:`PMA_ABSOLUTE_URI` in the docker-compose
454 image: phpmyadmin/phpmyadmin
455 container_name: phpmyadmin
457 domainname: example.com
461 - PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
462 - PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
465 - PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
472 #. Choose an appropriate distribution kit from the phpmyadmin.net
473 Downloads page. Some kits contain only the English messages, others
474 contain all languages. We'll assume you chose a kit whose name
475 looks like ``phpMyAdmin-x.x.x -all-languages.tar.gz``.
476 #. Ensure you have downloaded a genuine archive, see :ref:`verify`.
477 #. Untar or unzip the distribution (be sure to unzip the subdirectories):
478 ``tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz`` in your
479 webserver's document root. If you don't have direct access to your
480 document root, put the files in a directory on your local machine,
481 and, after step 4, transfer the directory on your web server using,
483 #. Ensure that all the scripts have the appropriate owner (if PHP is
484 running in safe mode, having some scripts with an owner different from
485 the owner of other scripts will be a problem). See :ref:`faq4_2` and
486 :ref:`faq1_26` for suggestions.
487 #. Now you must configure your installation. There are two methods that
488 can be used. Traditionally, users have hand-edited a copy of
489 :file:`config.inc.php`, but now a wizard-style setup script is provided
490 for those who prefer a graphical installation. Creating a
491 :file:`config.inc.php` is still a quick way to get started and needed for
492 some advanced features.
494 Manually creating the file
495 --------------------------
497 To manually create the file, simply use your text editor to create the
498 file :file:`config.inc.php` (you can copy :file:`config.sample.inc.php` to get
499 a minimal configuration file) in the main (top-level) phpMyAdmin
500 directory (the one that contains :file:`index.php`). phpMyAdmin first
501 loads :file:`libraries/config.default.php` and then overrides those values
502 with anything found in :file:`config.inc.php`. If the default value is
503 okay for a particular setting, there is no need to include it in
504 :file:`config.inc.php`. You'll probably need only a few directives to get going; a
505 simple configuration may look like this:
507 .. code-block:: xml+php
510 // use here a value of your choice at least 32 chars long
511 $cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o';
515 $cfg['Servers'][$i]['auth_type'] = 'cookie';
516 // if you insist on "root" having no password:
517 // $cfg['Servers'][$i]['AllowNoPassword'] = true;
519 Or, if you prefer to not be prompted every time you log in:
521 .. code-block:: xml+php
527 $cfg['Servers'][$i]['user'] = 'root';
528 $cfg['Servers'][$i]['password'] = 'cbb74bc'; // use here your password
529 $cfg['Servers'][$i]['auth_type'] = 'config';
533 Storing passwords in the configuration is insecure as anybody can then
534 manipulate your database.
536 For a full explanation of possible configuration values, see the
537 :ref:`config` of this document.
539 .. index:: Setup script
543 Using the Setup script
544 ----------------------
546 Instead of manually editing :file:`config.inc.php`, you can use phpMyAdmin's
547 setup feature. The file can be generated using the setup and you can download it
548 for upload to the server.
550 Next, open your browser and visit the location where you installed phpMyAdmin,
551 with the ``/setup`` suffix. The changes are not saved to the server, you need to
552 use the :guilabel:`Download` button to save them to your computer and then upload
555 Now the file is ready to be used. You can choose to review or edit the
556 file with your favorite editor, if you prefer to set some advanced
557 options that the setup script does not provide.
559 #. If you are using the ``auth_type`` "config", it is suggested that you
560 protect the phpMyAdmin installation directory because using config
561 does not require a user to enter a password to access the phpMyAdmin
562 installation. Use of an alternate authentication method is
563 recommended, for example with HTTP–AUTH in a :term:`.htaccess` file or switch to using
564 ``auth_type`` cookie or http. See the :ref:`faqmultiuser`
565 for additional information, especially :ref:`faq4_4`.
566 #. Open the main phpMyAdmin directory in your browser.
567 phpMyAdmin should now display a welcome screen and your databases, or
568 a login dialog if using :term:`HTTP` or
569 cookie authentication mode.
573 Setup script on Debian, Ubuntu and derivatives
574 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
576 Debian and Ubuntu have changed the way in which the setup script is enabled and disabled, in a way
577 that single command has to be executed for either of these.
579 To allow editing configuration invoke:
583 /usr/sbin/pma-configure
585 To block editing configuration invoke:
591 Setup script on openSUSE
592 ~~~~~~~~~~~~~~~~~~~~~~~~
594 Some openSUSE releases do not include setup script in the package. In case you
595 want to generate configuration on these you can either download original
596 package from <https://www.phpmyadmin.net/> or use setup script on our demo
597 server: <https://demo.phpmyadmin.net/master/setup/>.
601 Verifying phpMyAdmin releases
602 +++++++++++++++++++++++++++++
604 Since July 2015 all phpMyAdmin releases are cryptographically signed by the
605 releasing developer, who through January 2016 was Marc Delisle. His key id is
606 0xFEFC65D181AF644A, his PGP fingerprint is:
608 .. code-block:: console
610 436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A
612 and you can get more identification information from <https://keybase.io/lem9>.
614 Beginning in January 2016, the release manager is Isaac Bennetch. His key id is
615 0xCE752F178259BD92, and his PGP fingerprint is:
617 .. code-block:: console
619 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
621 and you can get more identification information from <https://keybase.io/ibennetch>.
623 Some additional downloads (for example themes) might be signed by Michal Čihař. His key id is
624 0x9C27B31342B7511D, and his PGP fingerprint is:
626 .. code-block:: console
628 63CB 1DF1 EF12 CF2A C0EE 5A32 9C27 B313 42B7 511D
630 and you can get more identification information from <https://keybase.io/nijel>.
632 You should verify that the signature matches the archive you have downloaded.
633 This way you can be sure that you are using the same code that was released.
634 You should also verify the date of the signature to make sure that you
635 downloaded the latest version.
637 Each archive is accompanied by ``.asc`` files which contain the PGP signature
638 for it. Once you have both of them in the same folder, you can verify the signature:
640 .. code-block:: console
642 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
643 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
644 gpg: Can't check signature: public key not found
646 As you can see gpg complains that it does not know the public key. At this
647 point, you should do one of the following steps:
649 * Download the keyring from `our download server <https://files.phpmyadmin.net/phpmyadmin.keyring>`_, then import it with:
651 .. code-block:: console
653 $ gpg --import phpmyadmin.keyring
655 * Download and import the key from one of the key servers:
657 .. code-block:: console
659 $ gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
660 gpg: requesting key 8259BD92 from hkp server pgp.mit.edu
661 gpg: key 8259BD92: public key "Isaac Bennetch <bennetch@gmail.com>" imported
662 gpg: no ultimately trusted keys found
663 gpg: Total number processed: 1
664 gpg: imported: 1 (RSA: 1)
666 This will improve the situation a bit - at this point, you can verify that the
667 signature from the given key is correct but you still can not trust the name used
670 .. code-block:: console
672 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
673 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
674 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>"
675 gpg: aka "Isaac Bennetch <isaac@bennetch.org>"
676 gpg: WARNING: This key is not certified with a trusted signature!
677 gpg: There is no indication that the signature belongs to the owner.
678 Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
680 The problem here is that anybody could issue the key with this name. You need to
681 ensure that the key is actually owned by the mentioned person. The GNU Privacy
682 Handbook covers this topic in the chapter `Validating other keys on your public
683 keyring`_. The most reliable method is to meet the developer in person and
684 exchange key fingerprints, however, you can also rely on the web of trust. This way
685 you can trust the key transitively though signatures of others, who have met
686 the developer in person. For example, you can see how `Isaac's key links to
689 Once the key is trusted, the warning will not occur:
691 .. code-block:: console
693 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
694 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
695 gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>" [full]
697 Should the signature be invalid (the archive has been changed), you would get a
698 clear error regardless of the fact that the key is trusted or not:
700 .. code-block:: console
702 $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
703 gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
704 gpg: BAD signature from "Isaac Bennetch <bennetch@gmail.com>" [unknown]
706 .. _Validating other keys on your public keyring: https://www.gnupg.org/gph/en/manual.html#AEN335
708 .. _Isaac's key links to Linus's key: https://pgp.cs.uu.nl/paths/79be3e4300411886/to/ce752f178259bd92.html
711 single: Configuration storage
712 single: phpMyAdmin configuration storage
717 phpMyAdmin configuration storage
718 ++++++++++++++++++++++++++++++++
720 .. versionchanged:: 3.4.0
722 Prior to phpMyAdmin 3.4.0 this was called Linked Tables Infrastructure, but
723 the name was changed due to the extended scope of the storage.
725 For a whole set of additional features (:ref:`bookmarks`, comments, :term:`SQL`-history,
726 tracking mechanism, :term:`PDF`-generation, :ref:`transformations`, :ref:`relations`
727 etc.) you need to create a set of special tables. Those tables can be located
728 in your own database, or in a central database for a multi-user installation
729 (this database would then be accessed by the controluser, so no other user
730 should have rights to it).
737 In many cases, this database structure can be automatically created and
738 configured. This is called “Zero Configuration” mode and can be particularly
739 useful in shared hosting situations. “Zeroconf” mode is on by default, to
740 disable set :config:option:`$cfg['ZeroConf']` to false.
742 The following three scenarios are covered by the Zero Configuration mode:
744 * When entering a database where the configuration storage tables are not
745 present, phpMyAdmin offers to create them from the Operations tab.
746 * When entering a database where the tables do already exist, the software
747 automatically detects this and begins using them. This is the most common
748 situation; after the tables are initially created automatically they are
749 continually used without disturbing the user; this is also most useful on
750 shared hosting where the user is not able to edit :file:`config.inc.php` and
751 usually the user only has access to one database.
752 * When having access to multiple databases, if the user first enters the
753 database containing the configuration storage tables then switches to
755 phpMyAdmin continues to use the tables from the first database; the user is
756 not prompted to create more tables in the new database.
761 Please look at your ``./sql/`` directory, where you should find a
762 file called *create\_tables.sql*. (If you are using a Windows server,
763 pay special attention to :ref:`faq1_23`).
765 If you already had this infrastructure and:
767 * upgraded to MySQL 4.1.2 or newer, please use
768 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
769 * upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (<= 4.2.x),
770 please use :file:`sql/upgrade_column_info_4_3_0+.sql`.
771 * upgraded to phpMyAdmin 4.7.0 or newer from 4.3.0 or newer,
772 please use :file:`sql/upgrade_tables_4_7_0+.sql`.
774 and then create new tables by importing :file:`sql/create_tables.sql`.
776 You can use your phpMyAdmin to create the tables for you. Please be
777 aware that you may need special (administrator) privileges to create
778 the database and tables, and that the script may need some tuning,
779 depending on the database name.
781 After having imported the :file:`sql/create_tables.sql` file, you
782 should specify the table names in your :file:`config.inc.php` file. The
783 directives used for that can be found in the :ref:`config`.
785 You will also need to have a controluser
786 (:config:option:`$cfg['Servers'][$i]['controluser']` and
787 :config:option:`$cfg['Servers'][$i]['controlpass']` settings)
788 with the proper rights to those tables. For example you can create it
789 using following statement:
791 And for any MariaDB version:
793 .. code-block:: mysql
795 CREATE USER 'pma'@'localhost' IDENTIFIED VIA mysql_native_password USING 'pmapass';
796 GRANT SELECT, INSERT, UPDATE, DELETE ON `<pma_db>`.* TO 'pma'@'localhost';
798 For MySQL 8.0 and newer:
800 .. code-block:: mysql
802 CREATE USER 'pma'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'pmapass';
803 GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
805 For MySQL older than 8.0:
807 .. code-block:: mysql
809 CREATE USER 'pma'@'localhost' IDENTIFIED WITH mysql_native_password AS 'pmapass';
810 GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
812 Note that MySQL installations with PHP older than 7.4 and MySQL newer than 8.0 may require
813 using the mysql_native_password authentication as a workaround, see
814 :ref:`faq1_45` for details.
818 Upgrading from an older version
819 +++++++++++++++++++++++++++++++
823 **Never** extract the new version over an existing installation of
824 phpMyAdmin, always first remove the old files keeping just the
827 This way, you will not leave any old or outdated files in the directory,
828 which can have severe security implications or can cause various breakages.
830 Simply copy :file:`config.inc.php` from your previous installation into
831 the newly unpacked one. Configuration files from old versions may
832 require some tweaking as some options have been changed or removed.
833 For compatibility with PHP 5.3 and later, remove a
834 ``set_magic_quotes_runtime(0);`` statement that you might find near
835 the end of your configuration file.
837 You should **not** copy :file:`libraries/config.default.php` over
838 :file:`config.inc.php` because the default configuration file is version-
841 The complete upgrade can be performed in a few simple steps:
843 1. Download the latest phpMyAdmin version from <https://www.phpmyadmin.net/downloads/>.
844 2. Rename existing phpMyAdmin folder (for example to ``phpmyadmin-old``).
845 3. Unpack freshly downloaded phpMyAdmin to the desired location (for example ``phpmyadmin``).
846 4. Copy :file:`config.inc.php`` from old location (``phpmyadmin-old``) to the new one (``phpmyadmin``).
847 5. Test that everything works properly.
848 6. Remove backup of a previous version (``phpmyadmin-old``).
850 If you have upgraded your MySQL server from a version previous to 4.1.2 to
851 version 5.x or newer and if you use the phpMyAdmin configuration storage, you
852 should run the :term:`SQL` script found in
853 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
855 If you have upgraded your phpMyAdmin to 4.3.0 or newer from 2.5.0 or
856 newer (<= 4.2.x) and if you use the phpMyAdmin configuration storage, you
857 should run the :term:`SQL` script found in
858 :file:`sql/upgrade_column_info_4_3_0+.sql`.
860 Do not forget to clear the browser cache and to empty the old session by
861 logging out and logging in again.
863 .. index:: Authentication mode
865 .. _authentication_modes:
867 Using authentication modes
868 ++++++++++++++++++++++++++
870 :term:`HTTP` and cookie authentication modes are recommended in a **multi-user
871 environment** where you want to give users access to their own database and
872 don't want them to play around with others. Nevertheless, be aware that MS
873 Internet Explorer seems to be really buggy about cookies, at least till version
874 6. Even in a **single-user environment**, you might prefer to use :term:`HTTP`
875 or cookie mode so that your user/password pair are not in clear in the
878 :term:`HTTP` and cookie authentication
879 modes are more secure: the MySQL login information does not need to be
880 set in the phpMyAdmin configuration file (except possibly for the
881 :config:option:`$cfg['Servers'][$i]['controluser']`).
882 However, keep in mind that the password travels in plain text unless
883 you are using the HTTPS protocol. In cookie mode, the password is
884 stored, encrypted with the AES algorithm, in a temporary cookie.
886 Then each of the *true* users should be granted a set of privileges
887 on a set of particular databases. Normally you shouldn't give global
888 privileges to an ordinary user unless you understand the impact of those
889 privileges (for example, you are creating a superuser).
890 For example, to grant the user *real_user* with all privileges on
891 the database *user_base*:
893 .. code-block:: mysql
895 GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real_password';
897 What the user may now do is controlled entirely by the MySQL user management
898 system. With HTTP or cookie authentication mode, you don't need to fill the
899 user/password fields inside the :config:option:`$cfg['Servers']`.
909 .. index:: pair: HTTP; Authentication mode
913 HTTP authentication mode
914 ------------------------
916 * Uses :term:`HTTP` Basic authentication
917 method and allows you to log in as any valid MySQL user.
918 * Is supported with most PHP configurations. For :term:`IIS` (:term:`ISAPI`)
919 support using :term:`CGI` PHP see :ref:`faq1_32`, for using with Apache
920 :term:`CGI` see :ref:`faq1_35`.
921 * When PHP is running under Apache's :term:`mod_proxy_fcgi` (e.g. with PHP-FPM),
922 ``Authorization`` headers are not passed to the underlying FCGI application,
923 such that your credentials will not reach the application. In this case, you can
924 add the following configuration directive:
926 .. code-block:: apache
928 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
930 * See also :ref:`faq4_4` about not using the :term:`.htaccess` mechanism along with
931 ':term:`HTTP`' authentication mode.
935 There is no way to do proper logout in HTTP authentication, most browsers
936 will remember credentials until there is no different successful
937 authentication. Because of this, this method has a limitation that you can not
938 login with the same user after logout.
940 .. index:: pair: Cookie; Authentication mode
944 Cookie authentication mode
945 --------------------------
947 * Username and password are stored in cookies during the session and password
948 is deleted when it ends.
949 * With this mode, the user can truly log out of phpMyAdmin and log
950 back in with the same username (this is not possible with :ref:`auth_http`).
951 * If you want to allow users to enter any hostname to connect (rather than only
952 servers that are configured in :file:`config.inc.php`),
953 see the :config:option:`$cfg['AllowArbitraryServer']` directive.
954 * As mentioned in the :ref:`require` section, having the ``openssl`` extension
955 will speed up access considerably, but is not required.
957 .. index:: pair: Signon; Authentication mode
961 Signon authentication mode
962 --------------------------
964 * This mode is a convenient way of using credentials from another
965 application to authenticate to phpMyAdmin to implement a single signon
967 * The other application has to store login information into session
968 data (see :config:option:`$cfg['Servers'][$i]['SignonSession']` and
969 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`) or you
970 need to implement script to return the credentials (see
971 :config:option:`$cfg['Servers'][$i]['SignonScript']`).
972 * When no credentials are available, the user is being redirected to
973 :config:option:`$cfg['Servers'][$i]['SignonURL']`, where you should handle
976 The very basic example of saving credentials in a session is available as
977 :file:`examples/signon.php`:
979 .. literalinclude:: ../examples/signon.php
982 Alternatively, you can also use this way to integrate with OpenID as shown
983 in :file:`examples/openid.php`:
985 .. literalinclude:: ../examples/openid.php
988 If you intend to pass the credentials using some other means than, you have to
989 implement wrapper in PHP to get that data and set it to
990 :config:option:`$cfg['Servers'][$i]['SignonScript']`. There is a very minimal example
991 in :file:`examples/signon-script.php`:
993 .. literalinclude:: ../examples/signon-script.php
997 :config:option:`$cfg['Servers'][$i]['auth_type']`,
998 :config:option:`$cfg['Servers'][$i]['SignonSession']`,
999 :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`,
1000 :config:option:`$cfg['Servers'][$i]['SignonScript']`,
1001 :config:option:`$cfg['Servers'][$i]['SignonURL']`,
1002 :ref:`example-signon`
1004 .. index:: pair: Config; Authentication mode
1008 Config authentication mode
1009 --------------------------
1011 * This mode is sometimes the less secure one because it requires you to fill the
1012 :config:option:`$cfg['Servers'][$i]['user']` and
1013 :config:option:`$cfg['Servers'][$i]['password']`
1014 fields (and as a result, anyone who can read your :file:`config.inc.php`
1015 can discover your username and password).
1016 * In the :ref:`faqmultiuser` section, there is an entry explaining how
1017 to protect your configuration file.
1018 * For additional security in this mode, you may wish to consider the
1019 Host authentication :config:option:`$cfg['Servers'][$i]['AllowDeny']['order']`
1020 and :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` configuration directives.
1021 * Unlike cookie and http, does not require a user to log in when first
1022 loading the phpMyAdmin site. This is by design but could allow any
1023 user to access your installation. Use of some restriction method is
1024 suggested, perhaps a :term:`.htaccess` file with the HTTP-AUTH directive or disallowing
1025 incoming HTTP requests at one’s router or firewall will suffice (both
1026 of which are beyond the scope of this manual but easily searchable
1031 Securing your phpMyAdmin installation
1032 +++++++++++++++++++++++++++++++++++++
1034 The phpMyAdmin team tries hard to make the application secure, however there
1035 are always ways to make your installation more secure:
1037 * Follow our `Security announcements <https://www.phpmyadmin.net/security/>`_ and upgrade
1038 phpMyAdmin whenever new vulnerability is published.
1039 * Serve phpMyAdmin on HTTPS only. Preferably, you should use HSTS as well, so that
1040 you're protected from protocol downgrade attacks.
1041 * Ensure your PHP setup follows recommendations for production sites, for example
1042 `display_errors <https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors>`_
1044 * Remove the ``test`` directory from phpMyAdmin, unless you are developing and need a test suite.
1045 * Remove the ``setup`` directory from phpMyAdmin, you will probably not
1046 use it after the initial setup.
1047 * Properly choose an authentication method - :ref:`cookie`
1048 is probably the best choice for shared hosting.
1049 * Deny access to auxiliary files in :file:`./libraries/` or
1050 :file:`./templates/` subfolders in your webserver configuration.
1051 Such configuration prevents from possible path exposure and cross side
1052 scripting vulnerabilities that might happen to be found in that code. For the
1053 Apache webserver, this is often accomplished with a :term:`.htaccess` file in
1055 * Deny access to temporary files, see :config:option:`$cfg['TempDir']` (if that
1056 is placed inside your web root, see also :ref:`web-dirs`.
1057 * It is generally a good idea to protect a public phpMyAdmin installation
1058 against access by robots as they usually can not do anything good there. You
1059 can do this using ``robots.txt`` file in the root of your webserver or limit
1060 access by web server configuration, see :ref:`faq1_42`.
1061 * In case you don't want all MySQL users to be able to access
1062 phpMyAdmin, you can use :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` to limit them
1063 or :config:option:`$cfg['Servers'][$i]['AllowRoot']` to deny root user access.
1064 * Enable :ref:`2fa` for your account.
1065 * Consider hiding phpMyAdmin behind an authentication proxy, so that
1066 users need to authenticate prior to providing MySQL credentials
1067 to phpMyAdmin. You can achieve this by configuring your web server to request
1068 HTTP authentication. For example in Apache this can be done with:
1070 .. code-block:: apache
1073 AuthName "Restricted Access"
1074 AuthUserFile /usr/share/phpmyadmin/passwd
1077 Once you have changed the configuration, you need to create a list of users which
1078 can authenticate. This can be done using the :program:`htpasswd` utility:
1082 htpasswd -c /usr/share/phpmyadmin/passwd username
1084 * If you are afraid of automated attacks, enabling Captcha by
1085 :config:option:`$cfg['CaptchaLoginPublicKey']` and
1086 :config:option:`$cfg['CaptchaLoginPrivateKey']` might be an option.
1087 * Failed login attemps are logged to syslog (if available, see
1088 :config:option:`$cfg['AuthLog']`). This can allow using a tool such as
1089 fail2ban to block brute-force attempts. Note that the log file used by syslog
1090 is not the same as the Apache error or access log files.
1091 * In case you're running phpMyAdmin together with other PHP applications, it is
1092 generally advised to use separate session storage for phpMyAdmin to avoid
1093 possible session-based attacks against it. You can use
1094 :config:option:`$cfg['SessionSavePath']` to achieve this.
1098 Using SSL for connection to database server
1099 +++++++++++++++++++++++++++++++++++++++++++
1101 It is recommended to use SSL when connecting to remote database server. There
1102 are several configuration options involved in the SSL setup:
1104 :config:option:`$cfg['Servers'][$i]['ssl']`
1105 Defines whether to use SSL at all. If you enable only this, the connection
1106 will be encrypted, but there is not authentication of the connection - you
1107 can not verify that you are talking to the right server.
1108 :config:option:`$cfg['Servers'][$i]['ssl_key']` and :config:option:`$cfg['Servers'][$i]['ssl_cert']`
1109 This is used for authentication of client to the server.
1110 :config:option:`$cfg['Servers'][$i]['ssl_ca']` and :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`
1111 The certificate authorities you trust for server certificates.
1112 This is used to ensure that you are talking to a trusted server.
1113 :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1114 This configuration disables server certificate verification. Use with
1119 :ref:`example-google-ssl`,
1120 :config:option:`$cfg['Servers'][$i]['ssl']`,
1121 :config:option:`$cfg['Servers'][$i]['ssl_key']`,
1122 :config:option:`$cfg['Servers'][$i]['ssl_cert']`,
1123 :config:option:`$cfg['Servers'][$i]['ssl_ca']`,
1124 :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`,
1125 :config:option:`$cfg['Servers'][$i]['ssl_ciphers']`,
1126 :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1131 Users with column-specific privileges are unable to "Browse"
1132 ------------------------------------------------------------
1134 If a user has only column-specific privileges on some (but not all) columns in a table, "Browse"
1135 will fail with an error message.
1137 As a workaround, a bookmarked query with the same name as the table can be created, this will
1138 run when using the "Browse" link instead. `Issue 11922 <https://github.com/phpmyadmin/phpmyadmin/issues/11922>`_.
1140 Trouble logging back in after logging out using 'http' authentication
1141 ----------------------------------------------------------------------
1143 When using the 'http' ``auth_type``, it can be impossible to log back in (when the logout comes
1144 manually or after a period of inactivity). `Issue 11898 <https://github.com/phpmyadmin/phpmyadmin/issues/11898>`_.
1146 .. _Composer tool: https://getcomposer.org/
1147 .. _Packagist: https://packagist.org/
1148 .. _Docker image: https://hub.docker.com/r/phpmyadmin/phpmyadmin/