Zum Inhalt springen

PhpMyAdmin/Installation: Unterschied zwischen den Versionen

Aus Foxwiki
Die Seite wurde neu angelegt: „== PHPMyAdmin Database Administration Tool == Since Debian 10, PHPMyAdmin is not available as .deb package anymore. Therefore we will install it from source.…“
 
K Textersetzung - „z. B. “ durch „beispielsweise “
 
(47 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== PHPMyAdmin Database Administration Tool ==
==Paketbasiert==
Since Debian 10, PHPMyAdmin is not available as .deb package anymore. Therefore we will install it from source.
=== Repository ===
deb https://deb.debian.org/debian bullseye-backports main


Create folders for PHPMyadmin:
=== Installation ===
apt install -t bullseye-backports phpmyadmin
 
You may find other ways on the [https://github.com/phpmyadmin/phpmyadmin/wiki/DebianUbuntu#related-issues-and-comments-on-install-methods Wiki for install methods on Ubuntu/Debian]
 
== Manuell==
=== Create folders ===
Create folders for PHPMyadmin
  mkdir /usr/share/phpmyadmin
  mkdir /usr/share/phpmyadmin
  mkdir /etc/phpmyadmin
  mkdir /etc/phpmyadmin
Zeile 9: Zeile 17:
  touch /etc/phpmyadmin/htpasswd.setup
  touch /etc/phpmyadmin/htpasswd.setup


Go to the /tmp directory and download the PHPMyAdmin sources:
=== Download ===
Go to the /tmp directory and download the PHPMyAdmin sources
  cd /tmp
  cd /tmp
  wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz
  wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz


===Unpack===
Unpack the downloaded archive file and move the files to the /usr/share/phpmyadmin folder and clean up the /tmp directory.
Unpack the downloaded archive file and move the files to the /usr/share/phpmyadmin folder and clean up the /tmp directory.
  tar xfz phpMyAdmin-4.9.0.1-all-languages.tar.gz
  tar xfz phpMyAdmin-4.9.0.1-all-languages.tar.gz
Zeile 19: Zeile 29:
  rm -rf phpMyAdmin-4.9.0.1-all-languages
  rm -rf phpMyAdmin-4.9.0.1-all-languages


===Create config file===
Create a new config file for PHPMyaAdmin based on the provided sample file:
Create a new config file for PHPMyaAdmin based on the provided sample file:
  cp /usr/share/phpmyadmin/config.sample.inc.php  /usr/share/phpmyadmin/config.inc.php
  cp /usr/share/phpmyadmin/config.sample.inc.php  /usr/share/phpmyadmin/config.inc.php


Open the config file with nano editor:
Open the config file with vi editor:
  nano /usr/share/phpmyadmin/config.inc.php
  vi /usr/share/phpmyadmin/config.inc.php


Set a secure password (blowfish secret) which must be 32 chars long:
Set a secure password (blowfish secret) which must be 32 chars long:
Zeile 33: Zeile 44:
  $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';
  $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';


Next, we create the Apache configuration file for PHPMyAdmin by opening a new file in nano editor:
=== Apache configuration===
  nano /etc/apache2/conf-available/phpmyadmin.conf
Next, we create the Apache configuration file for PHPMyAdmin by opening a new file in vi editor:
  vi /etc/apache2/conf-available/phpmyadmin.conf


Paste the following config into the file and save it.
Paste the following config into the file and save it.
Zeile 61: Zeile 73:
  </Directory>
  </Directory>


# Disallow web access to directories that don't need it
Disallow web access to directories that don't need it
  <Directory /usr/share/phpmyadmin/libraries>
  <Directory /usr/share/phpmyadmin/libraries>
   Order Deny,Allow
   Order Deny,Allow
Zeile 76: Zeile 88:
  systemctl restart apache2
  systemctl restart apache2


=== Configure phpMyadmin ===
In the next step, we will configure the phpMyadmin configuration store (database).
In the next step, we will configure the phpMyadmin configuration store (database).


Zeile 98: Zeile 111:
Enter the MariaDB root password on request.
Enter the MariaDB root password on request.


All we have to do now is to set the phpmyadmin user details in the configuration file. Open the file in nano editor again:
All we have to do now is to set the phpmyadmin user details in the configuration file. Open the file in vi editor again:
  nano /usr/share/phpmyadmin/config.inc.php
  vi /usr/share/phpmyadmin/config.inc.php


Scroll down until you see the lines below and edit them:
Scroll down until you see the lines below and edit them:
Zeile 131: Zeile 144:


I've marked the lines in red which I've edited. Replace ''mypassword'' with the password that you've chosen for the phpmyadmin user. Note that the // in front of the lines have been removed as well!
I've marked the lines in red which I've edited. Replace ''mypassword'' with the password that you've chosen for the phpmyadmin user. Note that the // in front of the lines have been removed as well!
=== Update ===
# Aktuelle phpMyAdmin herunterladen: https://www.phpmyadmin.net/downloads/
# Benennen Sie den vorhandenen phpMyAdmin-Ordner um (beispielsweise  in <tt>phpMyAdmin-alt</tt>).
# Entpacken der heruntergeladene Datei in das gewünschte Verzeichnis (beispielsweise  <tt>phpMyAdmin</tt>).
# Kopieren Sie <tt>config.inc.php</tt> aus dem alten Verzeichnis (<tt>phpMyAdmin-alt</tt>) in das neue (<tt>phpMyAdmin</tt>).
# Überprüfen Sie, ob alles ordnungsgemäß funktioniert.
# Entfernen Sie die Sicherung der vorigen Version (<tt>phpMyAdmin-alt</tt>).
Wenn Sie Ihren MySQL-Server von einer Version früher als 4.1.2 auf Version 5.x oder neuer aktualisiert haben und Sie den phpMyAdmin-Konfigurationsspeicher nutzen, sollten Sie das [https://docs.phpmyadmin.net/de/latest/glossary.html#term-sql SQL]-Skript <tt>sql/upgrade_tables_mysql_4_1_2+.sql</tt> ausführen.
Wenn Sie Ihr phpMyAdmin auf 4.3.0 oder neuer von 2.5.0 oder neuer (<= 4.2.x) aktualisiert haben und wenn Sie den phpMyAdmin-Konfigurationsspeicher nutzen, sollten Sie das [https://docs.phpmyadmin.net/de/latest/glossary.html#term-sql SQL]-Skript <tt>sql/upgrade_column_info_4_3_0+.sql</tt> ausführen.
Vergessen Sie nicht, den Browsercache zu löschen und die letzte Sitzung zu leeren, indem Sie sich abmelden und danach wieder anmelden.
= Links =
== Intern ==
# [[PhpMyAdmin]]
== Weblinks ==
# https://docs.phpmyadmin.net/de/latest/
# https://de.wikipedia.org/wiki/PhpMyAdmin
# https://github.com/phpmyadmin/phpmyadmin/wiki/DebianUbuntu
[[Kategorie:PhpMyAdmin]]
[[Kategorie:Linux/Installation]]

Aktuelle Version vom 28. April 2025, 10:47 Uhr

Paketbasiert

Repository

deb https://deb.debian.org/debian bullseye-backports main

Installation

apt install -t bullseye-backports phpmyadmin

You may find other ways on the Wiki for install methods on Ubuntu/Debian

Manuell

Create folders

Create folders for PHPMyadmin

mkdir /usr/share/phpmyadmin
mkdir /etc/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp
chown -R www-data:www-data /var/lib/phpmyadmin
touch /etc/phpmyadmin/htpasswd.setup

Download

Go to the /tmp directory and download the PHPMyAdmin sources

cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz

Unpack

Unpack the downloaded archive file and move the files to the /usr/share/phpmyadmin folder and clean up the /tmp directory.

tar xfz phpMyAdmin-4.9.0.1-all-languages.tar.gz
mv phpMyAdmin-4.9.0.1-all-languages/* /usr/share/phpmyadmin/
rm phpMyAdmin-4.9.0.1-all-languages.tar.gz
rm -rf phpMyAdmin-4.9.0.1-all-languages

Create config file

Create a new config file for PHPMyaAdmin based on the provided sample file:

cp /usr/share/phpmyadmin/config.sample.inc.php  /usr/share/phpmyadmin/config.inc.php

Open the config file with vi editor:

vi /usr/share/phpmyadmin/config.inc.php

Set a secure password (blowfish secret) which must be 32 chars long:

$cfg['blowfish_secret'] = 'bD3e6wva9fnd93jVsb7SDgeiBCd452Dh'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Don't use my example blowfish secret, set your own one!

Then add a line to set the directory which PHPMyAdmin shall use to store temporary files:

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

Apache configuration

Next, we create the Apache configuration file for PHPMyAdmin by opening a new file in vi editor:

vi /etc/apache2/conf-available/phpmyadmin.conf

Paste the following config into the file and save it.

# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
 Options FollowSymLinks
 DirectoryIndex index.php
 <IfModule mod_php7.c>
  AddType application/x-httpd-php .php
  php_flag magic_quotes_gpc Off
  php_flag track_vars On
  php_flag register_globals Off
  php_value include_path .
 </IfModule>

</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
 <IfModule mod_authn_file.c>
  AuthType Basic
  AuthName "phpMyAdmin Setup"
  AuthUserFile /etc/phpmyadmin/htpasswd.setup
 </IfModule>
Require valid-user
</Directory>

Disallow web access to directories that don't need it

<Directory /usr/share/phpmyadmin/libraries>
 Order Deny,Allow
 Deny from All
</Directory>

<Directory /usr/share/phpmyadmin/setup/lib>
 Order Deny,Allow
 Deny from All
</Directory>

Activate the configuration and restart Apache.

a2enconf phpmyadmin
systemctl restart apache2

Configure phpMyadmin

In the next step, we will configure the phpMyadmin configuration store (database).

Log into MariaDB as root user:

mysql -u root -p

In the MariaDB shell, create a new database for PHPMyAdmin:

MariaDB [(none)]> CREATE DATABASE phpmyadmin;

Then create a new user:

MariaDB [(none)]> CREATE USER 'pma'@'localhost' IDENTIFIED BY 'mypassword';

Replace the word mypassword with a secure password of your choice in the commands above and below, use the same password both times. Then grant the user access to this database and reload database permissions.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Finally, load the SQL tables into the database:

mysql -u root -p phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql

Enter the MariaDB root password on request.

All we have to do now is to set the phpmyadmin user details in the configuration file. Open the file in vi editor again:

vi /usr/share/phpmyadmin/config.inc.php

Scroll down until you see the lines below and edit them:

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = ;
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'mypassword';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

I've marked the lines in red which I've edited. Replace mypassword with the password that you've chosen for the phpmyadmin user. Note that the // in front of the lines have been removed as well!

Update

  1. Aktuelle phpMyAdmin herunterladen: https://www.phpmyadmin.net/downloads/
  2. Benennen Sie den vorhandenen phpMyAdmin-Ordner um (beispielsweise in phpMyAdmin-alt).
  3. Entpacken der heruntergeladene Datei in das gewünschte Verzeichnis (beispielsweise phpMyAdmin).
  4. Kopieren Sie config.inc.php aus dem alten Verzeichnis (phpMyAdmin-alt) in das neue (phpMyAdmin).
  5. Überprüfen Sie, ob alles ordnungsgemäß funktioniert.
  6. Entfernen Sie die Sicherung der vorigen Version (phpMyAdmin-alt).

Wenn Sie Ihren MySQL-Server von einer Version früher als 4.1.2 auf Version 5.x oder neuer aktualisiert haben und Sie den phpMyAdmin-Konfigurationsspeicher nutzen, sollten Sie das SQL-Skript sql/upgrade_tables_mysql_4_1_2+.sql ausführen.

Wenn Sie Ihr phpMyAdmin auf 4.3.0 oder neuer von 2.5.0 oder neuer (<= 4.2.x) aktualisiert haben und wenn Sie den phpMyAdmin-Konfigurationsspeicher nutzen, sollten Sie das SQL-Skript sql/upgrade_column_info_4_3_0+.sql ausführen.

Vergessen Sie nicht, den Browsercache zu löschen und die letzte Sitzung zu leeren, indem Sie sich abmelden und danach wieder anmelden.

Links

Intern

  1. PhpMyAdmin

Weblinks

  1. https://docs.phpmyadmin.net/de/latest/
  2. https://de.wikipedia.org/wiki/PhpMyAdmin
  3. https://github.com/phpmyadmin/phpmyadmin/wiki/DebianUbuntu