phpMyAdmin

phpMyAdmin is a web-based tool to help manage MariaDB or MySQL databases, written primarily in PHP and distributed under the GNU GPL.

Installation

Install the phpmyadmin package.

Running

PHP

Make sure the PHP mariadb and iconv extensions have been enabled.

Optionally you can enable extension=bz2 and extension=zip for compression support.

Note: If open_basedir has been set, make sure to include /usr/share/webapps and /etc/webapps to open_basedir in /etc/php/php.ini. See PHP#Configuration.

Apache

Set up Apache to use PHP as outlined in the Apache HTTP Server#PHP article.

Create the Apache configuration file:

/etc/httpd/conf/extra/phpmyadmin.conf
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

And include it in /etc/httpd/conf/httpd.conf:

# phpMyAdmin configuration
Include conf/extra/phpmyadmin.conf
Note: By default, everyone who can reach the Apache Web Server can see the phpMyAdmin login page under this URL. To change this, edit /etc/httpd/conf/extra/phpmyadmin.conf to your liking. For example, if you only want to be able to access it from the same machine, replace Require all granted by Require local. Beware that this will disallow connecting to PhpMyAdmin on a remote server. If you still want to access PhpMyAdmin on a remote server securely, you might want to consider setting up an OpenSSH#Encrypted SOCKS tunnel.

After making changes to the Apache configuration file, restart httpd.service.

Lighttpd

Configuring Lighttpd, make sure it is able to serve PHP files and has been enabled.

Add the following alias for PhpMyAdmin to the config:

alias.url = ( "/phpmyadmin" => "/usr/share/webapps/phpMyAdmin/")

Nginx

Make sure to set up nginx#FastCGI and use nginx#Server blocks to make management easier.

By preference, access phpMyAdmin by subdomain, e.g. :

Or by subdirectory, e.g. https://domain.tld/phpMyAdmin:

Configuration

The main configuration file is located at .

Define a remote MySQL server

If the MySQL server is a remote host, append the following line to the configuration file:

$cfg['Servers'][$i]['host'] = 'example.com';

Using setup script

To allow the usage of the phpMyAdmin setup script (e.g. http://localhost/phpmyadmin/setup), make sure /usr/share/webapps/phpMyAdmin is writable for the user:

# mkdir /usr/share/webapps/phpMyAdmin/config
# chown http:http /usr/share/webapps/phpMyAdmin/config
# chmod 750 /usr/share/webapps/phpMyAdmin/config

Add blowfish_secret passphrase

It is required to enter a unique 32 characters long string to fully use the blowfish algorithm used by phpMyAdmin, thus preventing the message ERROR: The configuration file now needs a secret passphrase (blowfish_secret):

Enabling Configuration Storage

Extra options such as table linking, change tracking, PDF creation, and bookmarking queries are disabled by default, displaying The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. on the homepage.

In , uncomment (remove the leading "//"s), and change them to your desired credentials if needed:

Setup database

Two options are available to create the required tables:

  • Import by using PhpMyAdmin.
  • Execute in the command line.

Setup database user

To apply the required permissions for , execute the following query:

GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
GRANT SELECT (
    Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
    Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
    File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
    Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
    Execute_priv, Repl_slave_priv, Repl_client_priv
    ) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
    ON mysql.tables_priv TO 'pma'@'localhost';

In order use the bookmark and relation features, set the following permissions:

GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';

Re-login to ensure the new features are activated.

Enabling template caching

Edit to add the line:

$cfg['TempDir'] = '/tmp/phpmyadmin';

Remove config directory

Remove temporary configuration directory once configuration is done. This will also suppress warning from web interface:

# rm -r /usr/share/webapps/phpMyAdmin/config

Install themes

Themes are located in . You can find new themes in https://www.phpmyadmin.net/themes/

You can simply download and extract the new theme and it will work after phpmyadmin refresh. However, you have to download theme for the correct version of phpmyadmin, themes for older versions will not work.

gollark: Heavserver has... 900?
gollark: I could load DistilGPT2 onto the osmarks.net™ apiary engines™ and see what it thinks.
gollark: ++experimental_qa "Buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo" Buffalo buffalo, buffalo?
gollark: Truly, apiaristic intelligence™ all things.
gollark: I see.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.