Translated using Weblate (Slovenian)
[phpmyadmin.git] / doc / setup.rst
blob7d386e0142cb3f63a3ca5254a449e00e080d4204
1 .. _setup:
3 Installation
4 ============
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.
11 Linux distributions
12 +++++++++++++++++++
14 phpMyAdmin is included in most Linux distributions. It is recommended to use
15 distribution packages when possible - they usually provide integration to your
16 distribution and you will automatically get security updates from your distribution.
18 .. _debian-package:
20 Debian and Ubuntu
21 -----------------
23 Most Debian and Ubuntu versions include a phpMyAdmin package, but be aware that
24 the configuration file is maintained in ``/etc/phpmyadmin`` and may differ in
25 some ways from the official phpMyAdmin documentation. Specifically, it does:
27 * Configuration of a web server (works for Apache and lighttpd).
28 * Creating of :ref:`linked-tables` using dbconfig-common.
29 * Securing setup script, see :ref:`debian-setup`.
31 More specific details about installing Debian or Ubuntu packages are available
32 `in our wiki <https://github.com/phpmyadmin/phpmyadmin/wiki/DebianUbuntu>`_.
34 .. seealso::
36     More information can be found in `README.Debian <https://salsa.debian.org/phpmyadmin-team/phpmyadmin/blob/debian/latest/debian/README.Debian>`_
37     (it is installed as :file:`/usr/share/doc/phpmyadmin/README.Debian` with the package).
39 OpenSUSE
40 --------
42 OpenSUSE already comes with phpMyAdmin package, just install packages from
43 the `openSUSE Build Service <https://software.opensuse.org/package/phpMyAdmin>`_.
45 Gentoo
46 ------
48 Gentoo ships the phpMyAdmin package, both in a near-stock configuration as well
49 as in a ``webapp-config`` configuration. Use ``emerge dev-db/phpmyadmin`` to
50 install.
52 Mandriva
53 --------
55 Mandriva ships the phpMyAdmin package in their ``contrib`` branch and can be
56 installed via the usual Control Center.
58 Fedora
59 ------
61 Fedora ships the phpMyAdmin package, but be aware that the configuration file
62 is maintained in ``/etc/phpMyAdmin/`` and may differ in some ways from the
63 official phpMyAdmin documentation.
65 Red Hat Enterprise Linux
66 ------------------------
68 Red Hat Enterprise Linux itself and thus derivatives like CentOS don't
69 ship phpMyAdmin, but the Fedora-driven repository
70 `Extra Packages for Enterprise Linux (EPEL) <https://docs.fedoraproject.org/en-US/epel/>`_
71 is doing so, if it's
72 `enabled <https://fedoraproject.org/wiki/EPEL/FAQ#howtouse>`_.
73 But be aware that the configuration file is maintained in
74 ``/etc/phpMyAdmin/`` and may differ in some ways from the
75 official phpMyAdmin documentation.
77 Installing on Windows
78 +++++++++++++++++++++
80 The easiest way to get phpMyAdmin on Windows is using third party products
81 which include phpMyAdmin together with a database and web server such as
82 `XAMPP <https://www.apachefriends.org/index.html>`_.
84 You can find more of such options at `Wikipedia <https://en.wikipedia.org/wiki/List_of_AMP_packages>`_.
86 Installing from Git
87 +++++++++++++++++++
89 In order to install from Git, you'll need a few supporting applications:
91 * `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/QA_5_2>`_
92 * `Composer <https://getcomposer.org/download/>`__
93 * `Node.js <https://nodejs.org/en/download/>`_ (version 12 or higher)
94 * `Yarn <https://classic.yarnpkg.com/en/docs/install>`_
96 You can clone current phpMyAdmin source from
97 ``https://github.com/phpmyadmin/phpmyadmin.git``:
99 .. code-block:: sh
101     git clone https://github.com/phpmyadmin/phpmyadmin.git
103 Additionally you need to install dependencies using `Composer <https://getcomposer.org>`__:
105 .. code-block:: sh
107     composer update
109 If you do not intend to develop, you can skip the installation of developer tools
110 by invoking:
112 .. code-block:: sh
114     composer update --no-dev
116 Finally, you'll need to use `Yarn`_ to install some JavaScript dependencies:
118 .. code-block:: sh
120     yarn install --production
122 .. _composer:
124 Installing using Composer
125 +++++++++++++++++++++++++
127 You can install phpMyAdmin using the `Composer tool`_, since 4.7.0 the releases
128 are automatically mirrored to the default `Packagist`_ repository.
130 .. note::
132     The content of the Composer repository is automatically generated
133     separately from the releases, so the content doesn't have to be
134     100% same as when you download the tarball. There should be no
135     functional differences though.
137 To install phpMyAdmin simply run:
139 .. code-block:: sh
141     composer create-project phpmyadmin/phpmyadmin
143 Alternatively you can use our own composer repository, which contains
144 the release tarballs and is available at
145 <https://www.phpmyadmin.net/packages.json>:
147 .. code-block:: sh
149     composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
151 .. _docker:
153 Installing using Docker
154 +++++++++++++++++++++++
156 phpMyAdmin comes with a `Docker official image`_, which you can easily deploy. You can
157 download it using:
159 .. code-block:: sh
161     docker pull phpmyadmin
163 The phpMyAdmin server will listen on port 80. It supports several ways of
164 configuring the link to the database server, either by Docker's link feature
165 by linking your database container to ``db`` for phpMyAdmin (by specifying
166 ``--link your_db_host:db``) or by environment variables (in this case it's up
167 to you to set up networking in Docker to allow the phpMyAdmin container to access
168 the database container over the network).
170 .. _docker-vars:
172 Docker environment variables
173 ----------------------------
175 You can configure several phpMyAdmin features using environment variables:
177 .. envvar:: PMA_ARBITRARY
179     Allows you to enter a database server hostname on login form.
181     .. seealso:: :config:option:`$cfg['AllowArbitraryServer']`
183 .. envvar:: PMA_HOST
185     Hostname or IP address of the database server to use.
187     .. seealso:: :config:option:`$cfg['Servers'][$i]['host']`
189 .. envvar:: PMA_HOSTS
191     Comma-separated hostnames or IP addresses of the database servers to use.
193     .. note:: Used only if :envvar:`PMA_HOST` is empty.
195 .. envvar:: PMA_VERBOSE
197     Verbose name of the database server.
199     .. seealso:: :config:option:`$cfg['Servers'][$i]['verbose']`
201 .. envvar:: PMA_VERBOSES
203     Comma-separated verbose name of the database servers.
205     .. note:: Used only if :envvar:`PMA_VERBOSE` is empty.
207 .. envvar:: PMA_USER
209     User name to use for :ref:`auth_config`.
211 .. envvar:: PMA_PASSWORD
213     Password to use for :ref:`auth_config`.
215 .. envvar:: PMA_PORT
217     Port of the database server to use.
219 .. envvar:: PMA_PORTS
221     Comma-separated ports of the database server to use.
223     .. note:: Used only if :envvar:`PMA_PORT` is empty.
225 .. envvar:: PMA_SOCKET
227     Socket file for the database connection.
229 .. envvar:: PMA_SOCKETS
231     Comma-separated list of socket files for the database connections.
233     .. note:: Used only if :envvar:`PMA_SOCKET` is empty.
235 .. envvar:: PMA_ABSOLUTE_URI
237     The fully-qualified path (``https://pma.example.net/``) where the reverse
238     proxy makes phpMyAdmin available.
240     .. seealso:: :config:option:`$cfg['PmaAbsoluteUri']`
242 .. envvar:: PMA_QUERYHISTORYDB
244     When set to `true`, enables storing SQL history to :config:option:`$cfg['Servers'][$i]['pmadb']`.
245     When `false`, history is stored in the browser and is cleared when logging out.
247     .. seealso:: :config:option:`$cfg['Servers'][$i]['history']`
248     .. seealso:: :config:option:`$cfg['QueryHistoryDB']`
250 .. envvar:: PMA_QUERYHISTORYMAX
252     When set to an integer, controls the number of history items.
254     .. seealso:: :config:option:`$cfg['QueryHistoryMax']`
256 .. envvar:: PMA_CONTROLHOST
258     When set, this points to an alternate database host used for storing the ":ref:`linked-tables`" database.
260     .. seealso:: :config:option:`$cfg['Servers'][$i]['controlhost']`
262 .. envvar:: PMA_CONTROLUSER
264     Defines the username for phpMyAdmin to use for the ":ref:`linked-tables`" database.
266     .. seealso:: :config:option:`$cfg['Servers'][$i]['controluser']`
268 .. envvar:: PMA_CONTROLPASS
270     Defines the password for phpMyAdmin to use for the ":ref:`linked-tables`" database.
272     .. seealso:: :config:option:`$cfg['Servers'][$i]['controlpass']`
274 .. envvar:: PMA_CONTROLPORT
276     When set, will override the default port (`3306`) for connecting to the control host.
278     .. seealso:: :config:option:`$cfg['Servers'][$i]['controlport']`
280 .. envvar:: PMA_PMADB
282     When set, define the name of the database to be used for the ":ref:`linked-tables`" database.
283     When not set, the advanced features are not enabled by default: they can still potentially be enabled by the user when logging in with the :ref:`zeroconf` feature.
285     .. note:: Suggested values: `phpmyadmin` or `pmadb`
287     .. seealso:: :config:option:`$cfg['Servers'][$i]['pmadb']`
289 .. envvar:: HIDE_PHP_VERSION
291     If defined, this option will hide the PHP version (`expose_php = Off`).
292     Set to any value (such as `HIDE_PHP_VERSION=true`).
294 .. envvar:: UPLOAD_LIMIT
296     If set, this option will override the default value for apache and php-fpm (this will change ``upload_max_filesize`` and ``post_max_size`` values).
298     .. note:: Format as `[0-9+](K,M,G)` default value is `2048K`
300 .. envvar:: MEMORY_LIMIT
302     If set, this option will override the phpMyAdmin memory limit :config:option:`$cfg['MemoryLimit']` and PHP's `memory_limit`.
304     .. note:: Format as `[0-9+](K,M,G)` where `K` is for Kilobytes, `M` for Megabytes, `G` for Gigabytes and `1K` = 1024 bytes. Default value is `512M`.
306 .. envvar:: MAX_EXECUTION_TIME
308     If set, this option will override the maximum execution time in seconds for phpMyAdmin :config:option:`$cfg['ExecTimeLimit']` and PHP's `max_execution_time`.
310     .. note:: Format as `[0-9+]`. Default value is `600`.
312 .. envvar:: PMA_CONFIG_BASE64
314     If set, this option will override the default `config.inc.php` with the base64 decoded contents of the variable.
316 .. envvar:: PMA_USER_CONFIG_BASE64
318     If set, this option will override the default `config.user.inc.php` with the base64 decoded contents of the variable.
320 .. envvar:: PMA_UPLOADDIR
322     If set, this option will set the path where files can be saved to be available to import (:config:option:`$cfg['UploadDir']`)
324 .. envvar:: PMA_SAVEDIR
326     If set, this option will set the path where exported files can be saved (:config:option:`$cfg['SaveDir']`)
328 .. envvar:: APACHE_PORT
330     If set, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`).
332 By default, :ref:`cookie` is used, but if :envvar:`PMA_USER` and
333 :envvar:`PMA_PASSWORD` are set, it is switched to :ref:`auth_config`.
335 .. note::
337     The credentials you need to log in are stored in the MySQL server, in case
338     of Docker image, there are various ways to set it (for example
339     :samp:`MYSQL_ROOT_PASSWORD` when starting the MySQL container). Please check
340     documentation for `MariaDB container <https://hub.docker.com/_/mariadb>`_
341     or `MySQL container <https://hub.docker.com/_/mysql>`_.
343 .. _docker-custom:
345 Customizing configuration
346 -------------------------
348 Additionally configuration can be tweaked by :file:`/etc/phpmyadmin/config.user.inc.php`. If
349 this file exists, it will be loaded after configuration is generated from above
350 environment variables, so you can override any configuration variable. This
351 configuration can be added as a volume when invoking docker using
352 `-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php` parameters.
354 Note that the supplied configuration file is applied after :ref:`docker-vars`,
355 but you can override any of the values.
357 For example to change the default behavior of CSV export you can use the following
358 configuration file:
360 .. code-block:: php
362     <?php
363     $cfg['Export']['csv_columns'] = true;
365 You can also use it to define server configuration instead of using the
366 environment variables listed in :ref:`docker-vars`:
368 .. code-block:: php
370     <?php
371     /* Override Servers array */
372     $cfg['Servers'] = [
373         1 => [
374             'auth_type' => 'cookie',
375             'host' => 'mydb1',
376             'port' => 3306,
377             'verbose' => 'Verbose name 1',
378         ],
379         2 => [
380             'auth_type' => 'cookie',
381             'host' => 'mydb2',
382             'port' => 3306,
383             'verbose' => 'Verbose name 2',
384         ],
385     ];
387 .. seealso::
389     See :ref:`config` for detailed description of configuration options.
391 Docker Volumes
392 --------------
394 You can use the following volumes to customize image behavior:
396 :file:`/etc/phpmyadmin/config.user.inc.php`
398     Can be used for additional settings, see the previous chapter for more details.
400 :file:`/sessions/`
402     Directory where PHP sessions are stored. You might want to share this
403     for example when using :ref:`auth_signon`.
405 :file:`/www/themes/`
407     Directory where phpMyAdmin looks for themes. By default only those shipped
408     with phpMyAdmin are included, but you can include additional phpMyAdmin
409     themes (see :ref:`themes`) by using Docker volumes.
411 Docker Examples
412 ---------------
414 To connect phpMyAdmin to a given server use:
416 .. code-block:: sh
418     docker run --name phpmyadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin:latest
420 To connect phpMyAdmin to more servers use:
422 .. code-block:: sh
424     docker run --name phpmyadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80 phpmyadmin:latest
426 To use arbitrary server option:
428 .. code-block:: sh
430     docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin:latest
432 You can also link the database container using Docker:
434 .. code-block:: sh
436     docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin:latest
438 Running with additional configuration:
440 .. code-block:: sh
442     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:latest
444 Running with additional themes:
446 .. code-block:: sh
448     docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/custom/phpmyadmin/themeName/:/var/www/html/themes/themeName/ phpmyadmin:latest
450 Using docker-compose
451 --------------------
453 Alternatively, you can also use docker-compose with the docker-compose.yml from
454 <https://github.com/phpmyadmin/docker>.  This will run phpMyAdmin with an
455 arbitrary server - allowing you to specify MySQL/MariaDB server on the login page.
457 .. code-block:: sh
459     docker compose up -d
461 Customizing configuration file using docker-compose
462 ---------------------------------------------------
464 You can use an external file to customize phpMyAdmin configuration and pass it
465 using the volumes directive:
467 .. code-block:: yaml
469     phpmyadmin:
470         image: phpmyadmin:latest
471         container_name: phpmyadmin
472         environment:
473          - PMA_ARBITRARY=1
474         restart: always
475         ports:
476          - 8080:80
477         volumes:
478          - /sessions
479          - ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
480          - /custom/phpmyadmin/theme/:/www/themes/theme/
482 .. seealso:: :ref:`docker-custom`
484 Running behind haproxy in a subdirectory
485 ----------------------------------------
487 When you want to expose phpMyAdmin running in a Docker container in a
488 subdirectory, you need to rewrite the request path in the server proxying the
489 requests.
491 For example, using haproxy it can be done as:
493 .. code-block:: text
495     frontend http
496         bind *:80
497         option forwardfor
498         option http-server-close
500         ### NETWORK restriction
501         acl LOCALNET  src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
503         # /phpmyadmin
504         acl phpmyadmin  path_dir /phpmyadmin
505         use_backend phpmyadmin if phpmyadmin LOCALNET
507     backend phpmyadmin
508         mode http
510         reqirep  ^(GET|POST|HEAD)\ /phpmyadmin/(.*)     \1\ /\2
512         # phpMyAdmin container IP
513         server localhost     172.30.21.21:80
515 When using traefik, something like following should work:
517 .. code-block:: text
519     defaultEntryPoints = ["http"]
520     [entryPoints]
521       [entryPoints.http]
522       address = ":80"
523         [entryPoints.http.redirect]
524           regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
525           replacement = "$1/"
527     [backends]
528       [backends.myadmin]
529         [backends.myadmin.servers.myadmin]
530         url="http://internal.address.to.pma"
532     [frontends]
533        [frontends.myadmin]
534        backend = "myadmin"
535        passHostHeader = true
536          [frontends.myadmin.routes.default]
537          rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
539 You then should specify :envvar:`PMA_ABSOLUTE_URI` in the docker-compose
540 configuration:
542 .. code-block:: yaml
544     version: '2'
546     services:
547       phpmyadmin:
548         restart: always
549         image: phpmyadmin:latest
550         container_name: phpmyadmin
551         hostname: phpmyadmin
552         domainname: example.com
553         ports:
554           - 8000:80
555         environment:
556           - PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
557           - PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
558           - PMA_USER=root
559           - PMA_PASSWORD=
560           - PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
562 IBM Cloud
563 +++++++++
565 One of our users has created a helpful guide for installing phpMyAdmin on the
566 `IBM Cloud platform <https://github.com/KissConsult/phpmyadmin_tutorial#readme>`_.
568 .. _quick_install:
570 Quick Install
571 +++++++++++++
573 #. Choose an appropriate distribution kit from the phpmyadmin.net
574    Downloads page. Some kits contain only the English messages, others
575    contain all languages. We'll assume you chose a kit whose name
576    looks like ``phpMyAdmin-x.x.x-all-languages.tar.gz``.
577 #. Ensure you have downloaded a genuine archive, see :ref:`verify`.
578 #. Untar or unzip the distribution (be sure to unzip the subdirectories):
579    ``tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz`` in your
580    webserver's document root. If you don't have direct access to your
581    document root, put the files in a directory on your local machine,
582    and, after step 4, transfer the directory on your web server using,
583    for example, FTP.
584 #. Ensure that all the scripts have the appropriate owner (if PHP is
585    running in safe mode, having some scripts with an owner different from
586    the owner of other scripts will be a problem). See :ref:`faq4_2` and
587    :ref:`faq1_26` for suggestions.
588 #. Now you must configure your installation. There are two methods that
589    can be used. Traditionally, users have hand-edited a copy of
590    :file:`config.inc.php`, but now a wizard-style setup script is provided
591    for those who prefer a graphical installation. Creating a
592    :file:`config.inc.php` is still a quick way to get started and needed for
593    some advanced features.
595 Manually creating the file
596 --------------------------
598 To manually create the file, simply use your text editor to create the
599 file :file:`config.inc.php` (you can copy :file:`config.sample.inc.php` to get
600 a minimal configuration file) in the main (top-level) phpMyAdmin
601 directory (the one that contains :file:`index.php`). phpMyAdmin first
602 loads the default configuration values and then overrides those values
603 with anything found in :file:`config.inc.php`. If the default value is
604 okay for a particular setting, there is no need to include it in
605 :file:`config.inc.php`. You'll probably need only a few directives to get going; a
606 simple configuration may look like this:
608 .. code-block:: xml+php
610     <?php
611     // The string is a hexadecimal representation of a 32-bytes long string of random bytes.
612     $cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
614     $i=0;
615     $i++;
616     $cfg['Servers'][$i]['auth_type']     = 'cookie';
617     // if you insist on "root" having no password:
618     // $cfg['Servers'][$i]['AllowNoPassword'] = true;
620 Or, if you prefer to not be prompted every time you log in:
622 .. code-block:: xml+php
624     <?php
626     $i=0;
627     $i++;
628     $cfg['Servers'][$i]['user']          = 'root';
629     $cfg['Servers'][$i]['password']      = 'changeme'; // use here your password
630     $cfg['Servers'][$i]['auth_type']     = 'config';
632 .. warning::
634     Storing passwords in the configuration is insecure as anybody can then
635     manipulate your database.
637 For a full explanation of possible configuration values, see the
638 :ref:`config` of this document.
640 .. index:: Setup script
642 .. _setup_script:
644 Using the Setup script
645 ----------------------
647 Instead of manually editing :file:`config.inc.php`, you can use phpMyAdmin's
648 setup feature. The file can be generated using the setup and you can download it
649 for upload to the server.
651 Next, open your browser and visit the location where you installed phpMyAdmin,
652 with the ``/setup`` suffix. The changes are not saved to the server, you need to
653 use the :guilabel:`Download` button to save them to your computer and then upload
654 to the server.
656 Now the file is ready to be used. You can choose to review or edit the
657 file with your favorite editor, if you prefer to set some advanced
658 options that the setup script does not provide.
660 #. If you are using the ``auth_type`` "config", it is suggested that you
661    protect the phpMyAdmin installation directory because using config
662    does not require a user to enter a password to access the phpMyAdmin
663    installation. Use of an alternate authentication method is
664    recommended, for example with HTTP–AUTH in a :term:`.htaccess` file or switch to using
665    ``auth_type`` cookie or http. See the :ref:`faqmultiuser`
666    for additional information, especially :ref:`faq4_4`.
667 #. Open the main phpMyAdmin directory in your browser.
668    phpMyAdmin should now display a welcome screen and your databases, or
669    a login dialog if using :term:`HTTP` or
670    cookie authentication mode.
672 .. _debian-setup:
674 Setup script on Debian, Ubuntu and derivatives
675 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
677 Debian and Ubuntu have changed the way in which the setup script is enabled and disabled, in a way
678 that single command has to be executed for either of these.
680 To allow editing configuration invoke:
682 .. code-block:: sh
684    /usr/sbin/pma-configure
686 To block editing configuration invoke:
688 .. code-block:: sh
690     /usr/sbin/pma-secure
692 Setup script on openSUSE
693 ~~~~~~~~~~~~~~~~~~~~~~~~
695 Some openSUSE releases do not include setup script in the package. In case you
696 want to generate configuration on these you can either download original
697 package from <https://www.phpmyadmin.net/> or use setup script on our demo
698 server: <https://demo.phpmyadmin.net/master/setup/>.
700 .. _verify:
702 Verifying phpMyAdmin releases
703 +++++++++++++++++++++++++++++
705 Since July 2015 all phpMyAdmin releases are cryptographically signed by the
706 releasing developer, who through January 2016 was Marc Delisle. His key id is
707 0xFEFC65D181AF644A, his PGP fingerprint is:
709 .. code-block:: console
711     436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A
713 and you can get more identification information from <https://keybase.io/lem9>.
715 Beginning in January 2016, the release manager is Isaac Bennetch. His key id is
716 0xCE752F178259BD92, and his PGP fingerprint is:
718 .. code-block:: console
720     3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
722 and you can get more identification information from <https://keybase.io/ibennetch>.
724 Some additional downloads (for example themes) might be signed by Michal Čihař. His key id is
725 0x9C27B31342B7511D, and his PGP fingerprint is:
727 .. code-block:: console
729     63CB 1DF1 EF12 CF2A C0EE 5A32 9C27 B313 42B7 511D
731 and you can get more identification information from <https://keybase.io/nijel>.
733 You should verify that the signature matches the archive you have downloaded.
734 This way you can be sure that you are using the same code that was released.
735 You should also verify the date of the signature to make sure that you
736 downloaded the latest version.
738 Each archive is accompanied by ``.asc`` files which contain the PGP signature
739 for it. Once you have both of them in the same folder, you can verify the signature:
741 .. code-block:: console
743     $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
744     gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
745     gpg: Can't check signature: public key not found
747 As you can see gpg complains that it does not know the public key. At this
748 point, you should do one of the following steps:
750 * Download the keyring from `our download server <https://files.phpmyadmin.net/phpmyadmin.keyring>`_, then import it with:
752 .. code-block:: console
754    $ gpg --import phpmyadmin.keyring
756 * Download and import the key from one of the key servers:
758 .. code-block:: console
760     $ gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
761     gpg: requesting key 8259BD92 from hkp server pgp.mit.edu
762     gpg: key 8259BD92: public key "Isaac Bennetch <bennetch@gmail.com>" imported
763     gpg: no ultimately trusted keys found
764     gpg: Total number processed: 1
765     gpg:               imported: 1  (RSA: 1)
767 This will improve the situation a bit - at this point, you can verify that the
768 signature from the given key is correct but you still can not trust the name used
769 in the key:
771 .. code-block:: console
773     $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
774     gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
775     gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>"
776     gpg:                 aka "Isaac Bennetch <isaac@bennetch.org>"
777     gpg: WARNING: This key is not certified with a trusted signature!
778     gpg:          There is no indication that the signature belongs to the owner.
779     Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51  1C17 CE75 2F17 8259 BD92
781 The problem here is that anybody could issue the key with this name.  You need to
782 ensure that the key is actually owned by the mentioned person.  The GNU Privacy
783 Handbook covers this topic in the chapter `Validating other keys on your public
784 keyring`_. The most reliable method is to meet the developer in person and
785 exchange key fingerprints, however, you can also rely on the web of trust. This way
786 you can trust the key transitively though signatures of others, who have met
787 the developer in person.
789 Once the key is trusted, the warning will not occur:
791 .. code-block:: console
793     $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
794     gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
795     gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>" [full]
797 Should the signature be invalid (the archive has been changed), you would get a
798 clear error regardless of the fact that the key is trusted or not:
800 .. code-block:: console
802     $ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
803     gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
804     gpg: BAD signature from "Isaac Bennetch <bennetch@gmail.com>" [unknown]
806 .. _Validating other keys on your public keyring: https://www.gnupg.org/gph/en/manual.html#AEN335
808 .. index::
809     single: Configuration storage
810     single: phpMyAdmin configuration storage
811     single: pmadb
813 .. _linked-tables:
815 phpMyAdmin configuration storage
816 ++++++++++++++++++++++++++++++++
818 .. versionchanged:: 3.4.0
820    Prior to phpMyAdmin 3.4.0 this was called Linked Tables Infrastructure, but
821    the name was changed due to the extended scope of the storage.
823 For a whole set of additional features (:ref:`bookmarks`, comments, :term:`SQL`-history,
824 tracking mechanism, :term:`PDF`-generation, :ref:`transformations`, :ref:`relations`
825 etc.) you need to create a set of special tables.  Those tables can be located
826 in your own database, or in a central database for a multi-user installation
827 (this database would then be accessed by the controluser, so no other user
828 should have rights to it).
830 .. _zeroconf:
832 Zero configuration
833 ------------------
835 In many cases, this database structure can be automatically created and
836 configured. This is called “Zero Configuration” mode and can be particularly
837 useful in shared hosting situations. “Zeroconf” mode is on by default, to
838 disable set :config:option:`$cfg['ZeroConf']` to false.
840 The following three scenarios are covered by the Zero Configuration mode:
842 * When entering a database where the configuration storage tables are not
843   present, phpMyAdmin offers to create them from the Operations tab.
844 * When entering a database where the tables do already exist, the software
845   automatically detects this and begins using them. This is the most common
846   situation; after the tables are initially created automatically they are
847   continually used without disturbing the user; this is also most useful on
848   shared hosting where the user is not able to edit :file:`config.inc.php` and
849   usually the user only has access to one database.
850 * When having access to multiple databases, if the user first enters the
851   database containing the configuration storage tables then switches to
852   another database,
853   phpMyAdmin continues to use the tables from the first database; the user is
854   not prompted to create more tables in the new database.
856 Manual configuration
857 --------------------
859 Please look at your ``./sql/`` directory, where you should find a
860 file called *create\_tables.sql*. (If you are using a Windows server,
861 pay special attention to :ref:`faq1_23`).
863 If you already had this infrastructure and:
865 * upgraded to MySQL 4.1.2 or newer, please use
866   :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
867 * upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (<= 4.2.x),
868   please use :file:`sql/upgrade_column_info_4_3_0+.sql`.
869 * upgraded to phpMyAdmin 4.7.0 or newer from 4.3.0 or newer,
870   please use :file:`sql/upgrade_tables_4_7_0+.sql`.
872 and then create new tables by importing :file:`sql/create_tables.sql`.
874 You can use your phpMyAdmin to create the tables for you. Please be
875 aware that you may need special (administrator) privileges to create
876 the database and tables, and that the script may need some tuning,
877 depending on the database name.
879 After having imported the :file:`sql/create_tables.sql` file, you
880 should specify the table names in your :file:`config.inc.php` file. The
881 directives used for that can be found in the :ref:`config`.
883 You will also need to have a controluser
884 (:config:option:`$cfg['Servers'][$i]['controluser']` and
885 :config:option:`$cfg['Servers'][$i]['controlpass']` settings)
886 with the proper rights to those tables. For example you can create it
887 using following statement:
889 And for any MariaDB version:
891 .. code-block:: mysql
893    CREATE USER 'pma'@'localhost' IDENTIFIED VIA mysql_native_password USING 'pmapass';
894    GRANT SELECT, INSERT, UPDATE, DELETE ON `<pma_db>`.* TO 'pma'@'localhost';
896 For MySQL 8.0 and newer:
898 .. code-block:: mysql
900    CREATE USER 'pma'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'pmapass';
901    GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
903 For MySQL older than 8.0:
905 .. code-block:: mysql
907    CREATE USER 'pma'@'localhost' IDENTIFIED WITH mysql_native_password AS 'pmapass';
908    GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
910 Note that MySQL installations with PHP older than 7.4 and MySQL newer than 8.0 may require
911 using the mysql_native_password authentication as a workaround, see
912 :ref:`faq1_45` for details.
914 .. _upgrading:
916 Upgrading from an older version
917 +++++++++++++++++++++++++++++++
919 .. warning::
921     **Never** extract the new version over an existing installation of
922     phpMyAdmin, always first remove the old files keeping just the
923     configuration.
925     This way, you will not leave any old or outdated files in the directory,
926     which can have severe security implications or can cause various breakages.
928 Simply copy :file:`config.inc.php` from your previous installation into
929 the newly unpacked one. Configuration files from old versions may
930 require some tweaking as some options have been changed or removed.
931 For compatibility with PHP 5.3 and later, remove a
932 ``set_magic_quotes_runtime(0);`` statement that you might find near
933 the end of your configuration file.
935 The complete upgrade can be performed in a few simple steps:
937 1. Download the latest phpMyAdmin version from <https://www.phpmyadmin.net/downloads/>.
938 2. Rename existing phpMyAdmin folder (for example to ``phpmyadmin-old``).
939 3. Unpack freshly downloaded phpMyAdmin to the desired location (for example ``phpmyadmin``).
940 4. Copy :file:`config.inc.php`` from old location (``phpmyadmin-old``) to the new one (``phpmyadmin``).
941 5. Test that everything works properly.
942 6. Remove backup of a previous version (``phpmyadmin-old``).
944 If you have upgraded your MySQL server from a version previous to 4.1.2 to
945 version 5.x or newer and if you use the phpMyAdmin configuration storage, you
946 should run the :term:`SQL` script found in
947 :file:`sql/upgrade_tables_mysql_4_1_2+.sql`.
949 If you have upgraded your phpMyAdmin to 4.3.0 or newer from 2.5.0 or
950 newer (<= 4.2.x) and if you use the phpMyAdmin configuration storage, you
951 should run the :term:`SQL` script found in
952 :file:`sql/upgrade_column_info_4_3_0+.sql`.
954 Do not forget to clear the browser cache and to empty the old session by
955 logging out and logging in again.
957 .. index:: Authentication mode
959 .. _authentication_modes:
961 Using authentication modes
962 ++++++++++++++++++++++++++
964 :term:`HTTP` and cookie authentication modes are recommended in a **multi-user
965 environment** where you want to give users access to their own database and
966 don't want them to play around with others. Nevertheless, be aware that MS
967 Internet Explorer seems to be really buggy about cookies, at least till version
968 6. Even in a **single-user environment**, you might prefer to use :term:`HTTP`
969 or cookie mode so that your user/password pair are not in clear in the
970 configuration file.
972 :term:`HTTP` and cookie authentication
973 modes are more secure: the MySQL login information does not need to be
974 set in the phpMyAdmin configuration file (except possibly for the
975 :config:option:`$cfg['Servers'][$i]['controluser']`).
976 However, keep in mind that the password travels in plain text unless
977 you are using the HTTPS protocol. In cookie mode, the password is
978 stored, encrypted with the AES algorithm, in a temporary cookie.
980 Then each of the *true* users should be granted a set of privileges
981 on a set of particular databases. Normally you shouldn't give global
982 privileges to an ordinary user unless you understand the impact of those
983 privileges (for example, you are creating a superuser).
984 For example, to grant the user *real_user* with all privileges on
985 the database *user_base*:
987 .. code-block:: mysql
989    GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real_password';
991 What the user may now do is controlled entirely by the MySQL user management
992 system. With HTTP or cookie authentication mode, you don't need to fill the
993 user/password fields inside the :config:option:`$cfg['Servers']`.
995 .. seealso::
997     :ref:`faq1_32`,
998     :ref:`faq1_35`,
999     :ref:`faq4_1`,
1000     :ref:`faq4_2`,
1001     :ref:`faq4_3`
1003 .. index:: pair: HTTP; Authentication mode
1005 .. _auth_http:
1007 HTTP authentication mode
1008 ------------------------
1010 * Uses :term:`HTTP` Basic authentication
1011   method and allows you to log in as any valid MySQL user.
1012 * Is supported with most PHP configurations. For :term:`IIS` (:term:`ISAPI`)
1013   support using :term:`CGI` PHP see :ref:`faq1_32`, for using with Apache
1014   :term:`CGI` see :ref:`faq1_35`.
1015 * When PHP is running under Apache's :term:`mod_proxy_fcgi` (e.g. with PHP-FPM),
1016   ``Authorization`` headers are not passed to the underlying FCGI application,
1017   such that your credentials will not reach the application. In this case, you can
1018   add the following configuration directive:
1020   .. code-block:: apache
1022      SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
1024 * See also :ref:`faq4_4` about not using the :term:`.htaccess` mechanism along with
1025   ':term:`HTTP`' authentication mode.
1027 .. note::
1029     There is no way to do proper logout in HTTP authentication, most browsers
1030     will remember credentials until there is no different successful
1031     authentication. Because of this, this method has a limitation that you can not
1032     login with the same user after logout.
1034 .. index:: pair: Cookie; Authentication mode
1036 .. _cookie:
1038 Cookie authentication mode
1039 --------------------------
1041 * Username and password are stored in cookies during the session and password
1042   is deleted when it ends.
1043 * With this mode, the user can truly log out of phpMyAdmin and log
1044   back in with the same username (this is not possible with :ref:`auth_http`).
1045 * If you want to allow users to enter any hostname to connect (rather than only
1046   servers that are configured in :file:`config.inc.php`),
1047   see the :config:option:`$cfg['AllowArbitraryServer']` directive.
1048 * As mentioned in the :ref:`require` section, having the ``openssl`` extension
1049   will speed up access considerably, but is not required.
1051 .. index:: pair: Signon; Authentication mode
1053 .. _auth_signon:
1055 Signon authentication mode
1056 --------------------------
1058 * This mode is a convenient way of using credentials from another
1059   application to authenticate to phpMyAdmin to implement a single signon
1060   solution.
1061 * The other application has to store login information into session
1062   data (see :config:option:`$cfg['Servers'][$i]['SignonSession']` and
1063   :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`) or you
1064   need to implement script to return the credentials (see
1065   :config:option:`$cfg['Servers'][$i]['SignonScript']`).
1066 * When no credentials are available, the user is being redirected to
1067   :config:option:`$cfg['Servers'][$i]['SignonURL']`, where you should handle
1068   the login process.
1070 The very basic example of saving credentials in a session is available as
1071 :file:`examples/signon.php`:
1073 .. literalinclude:: ../examples/signon.php
1074     :language: php
1076 Alternatively, you can also use this way to integrate with OpenID as shown
1077 in :file:`examples/openid.php`:
1079 .. literalinclude:: ../examples/openid.php
1080     :language: php
1082 If you intend to pass the credentials using some other means than, you have to
1083 implement wrapper in PHP to get that data and set it to
1084 :config:option:`$cfg['Servers'][$i]['SignonScript']`. There is a very minimal example
1085 in :file:`examples/signon-script.php`:
1087 .. literalinclude:: ../examples/signon-script.php
1088     :language: php
1090 .. seealso::
1091     :config:option:`$cfg['Servers'][$i]['auth_type']`,
1092     :config:option:`$cfg['Servers'][$i]['SignonSession']`,
1093     :config:option:`$cfg['Servers'][$i]['SignonCookieParams']`,
1094     :config:option:`$cfg['Servers'][$i]['SignonScript']`,
1095     :config:option:`$cfg['Servers'][$i]['SignonURL']`,
1096     :ref:`example-signon`
1098 .. index:: pair: Config; Authentication mode
1100 .. _auth_config:
1102 Config authentication mode
1103 --------------------------
1105 * This mode is sometimes the less secure one because it requires you to fill the
1106   :config:option:`$cfg['Servers'][$i]['user']` and
1107   :config:option:`$cfg['Servers'][$i]['password']`
1108   fields (and as a result, anyone who can read your :file:`config.inc.php`
1109   can discover your username and password).
1110 * In the :ref:`faqmultiuser` section, there is an entry explaining how
1111   to protect your configuration file.
1112 * For additional security in this mode, you may wish to consider the
1113   Host authentication :config:option:`$cfg['Servers'][$i]['AllowDeny']['order']`
1114   and :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` configuration directives.
1115 * Unlike cookie and http, does not require a user to log in when first
1116   loading the phpMyAdmin site. This is by design but could allow any
1117   user to access your installation. Use of some restriction method is
1118   suggested, perhaps a :term:`.htaccess` file with the HTTP-AUTH directive or disallowing
1119   incoming HTTP requests at one’s router or firewall will suffice (both
1120   of which are beyond the scope of this manual but easily searchable
1121   with Google).
1123 .. _securing:
1125 Securing your phpMyAdmin installation
1126 +++++++++++++++++++++++++++++++++++++
1128 The phpMyAdmin team tries hard to make the application secure, however there
1129 are always ways to make your installation more secure:
1131 * Follow our `Security announcements <https://www.phpmyadmin.net/security/>`_ and upgrade
1132   phpMyAdmin whenever new vulnerability is published.
1133 * Serve phpMyAdmin on HTTPS only. Preferably, you should use HSTS as well, so that
1134   you're protected from protocol downgrade attacks.
1135 * Ensure your PHP setup follows recommendations for production sites, for example
1136   `display_errors <https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors>`_
1137   should be disabled.
1138 * Remove the ``test`` directory from phpMyAdmin, unless you are developing and need a test suite.
1139 * Remove the ``setup`` directory from phpMyAdmin, you will probably not
1140   use it after the initial setup.
1141 * Properly choose an authentication method - :ref:`cookie`
1142   is probably the best choice for shared hosting.
1143 * Deny access to auxiliary files in :file:`./libraries/` or
1144   :file:`./templates/` subfolders in your webserver configuration.
1145   Such configuration prevents from possible path exposure and cross side
1146   scripting vulnerabilities that might happen to be found in that code. For the
1147   Apache webserver, this is often accomplished with a :term:`.htaccess` file in
1148   those directories.
1149 * Deny access to temporary files, see :config:option:`$cfg['TempDir']` (if that
1150   is placed inside your web root, see also :ref:`web-dirs`.
1151 * It is generally a good idea to protect a public phpMyAdmin installation
1152   against access by robots as they usually can not do anything good there. You
1153   can do this using ``robots.txt`` file in the root of your webserver or limit
1154   access by web server configuration, see :ref:`faq1_42`.
1155 * In case you don't want all MySQL users to be able to access
1156   phpMyAdmin, you can use :config:option:`$cfg['Servers'][$i]['AllowDeny']['rules']` to limit them
1157   or :config:option:`$cfg['Servers'][$i]['AllowRoot']` to deny root user access.
1158 * Enable :ref:`2fa` for your account.
1159 * Consider hiding phpMyAdmin behind an authentication proxy, so that
1160   users need to authenticate prior to providing MySQL credentials
1161   to phpMyAdmin. You can achieve this by configuring your web server to request
1162   HTTP authentication. For example in Apache this can be done with:
1164   .. code-block:: apache
1166      AuthType Basic
1167      AuthName "Restricted Access"
1168      AuthUserFile /usr/share/phpmyadmin/passwd
1169      Require valid-user
1171   Once you have changed the configuration, you need to create a list of users which
1172   can authenticate. This can be done using the :program:`htpasswd` utility:
1174   .. code-block:: sh
1176      htpasswd -c /usr/share/phpmyadmin/passwd username
1178 * If you are afraid of automated attacks, enabling Captcha by
1179   :config:option:`$cfg['CaptchaLoginPublicKey']` and
1180   :config:option:`$cfg['CaptchaLoginPrivateKey']` might be an option.
1181 * Failed login attempts are logged to syslog (if available, see
1182   :config:option:`$cfg['AuthLog']`). This can allow using a tool such as
1183   fail2ban to block brute-force attempts. Note that the log file used by syslog
1184   is not the same as the Apache error or access log files.
1185 * In case you're running phpMyAdmin together with other PHP applications, it is
1186   generally advised to use separate session storage for phpMyAdmin to avoid
1187   possible session-based attacks against it. You can use
1188   :config:option:`$cfg['SessionSavePath']` to achieve this.
1190 .. _ssl:
1192 Using SSL for connection to database server
1193 +++++++++++++++++++++++++++++++++++++++++++
1195 It is recommended to use SSL when connecting to remote database server. There
1196 are several configuration options involved in the SSL setup:
1198 :config:option:`$cfg['Servers'][$i]['ssl']`
1199     Defines whether to use SSL at all. If you enable only this, the connection
1200     will be encrypted, but there is not authentication of the connection - you
1201     can not verify that you are talking to the right server.
1202 :config:option:`$cfg['Servers'][$i]['ssl_key']` and :config:option:`$cfg['Servers'][$i]['ssl_cert']`
1203     This is used for authentication of client to the server.
1204 :config:option:`$cfg['Servers'][$i]['ssl_ca']` and :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`
1205     The certificate authorities you trust for server certificates.
1206     This is used to ensure that you are talking to a trusted server.
1207 :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1208     This configuration disables server certificate verification. Use with
1209     caution.
1211 When the database server is using a local connection or private network and SSL can not be configured
1212 you can use :config:option:`$cfg['MysqlSslWarningSafeHosts']` to explicitly list the hostnames that are considered secure.
1214 .. seealso::
1216     :ref:`example-google-ssl`,
1217     :ref:`example-aws-ssl`,
1218     :config:option:`$cfg['Servers'][$i]['ssl']`,
1219     :config:option:`$cfg['Servers'][$i]['ssl_key']`,
1220     :config:option:`$cfg['Servers'][$i]['ssl_cert']`,
1221     :config:option:`$cfg['Servers'][$i]['ssl_ca']`,
1222     :config:option:`$cfg['Servers'][$i]['ssl_ca_path']`,
1223     :config:option:`$cfg['Servers'][$i]['ssl_ciphers']`,
1224     :config:option:`$cfg['Servers'][$i]['ssl_verify']`
1226 Known issues
1227 ++++++++++++
1229 Users with column-specific privileges are unable to "Browse"
1230 ------------------------------------------------------------
1232 If a user has only column-specific privileges on some (but not all) columns in a table, "Browse"
1233 will fail with an error message.
1235 As a workaround, a bookmarked query with the same name as the table can be created, this will
1236 run when using the "Browse" link instead. `Issue 11922 <https://github.com/phpmyadmin/phpmyadmin/issues/11922>`_.
1238 Trouble logging back in after logging out using 'http' authentication
1239 ----------------------------------------------------------------------
1241 When using the 'http' ``auth_type``, it can be impossible to log back in (when the logout comes
1242 manually or after a period of inactivity). `Issue 11898 <https://github.com/phpmyadmin/phpmyadmin/issues/11898>`_.
1244 .. _Composer tool: https://getcomposer.org/
1245 .. _Packagist: https://packagist.org/
1246 .. _Docker official image: https://hub.docker.com/_/phpmyadmin