Posicionarse en el directorio /tmp
cd /tmp
Descargar el archivo de PHPMyAdmin del sitio de respositorios oficial
wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.zip
Instalar el unzip
apt install unzip
Descomprimir el archivo phpMyAdmin-5.1.1-all-languages.zip
unzip phpMyAdmin-5.1.1-all-languages.zip
Mover phpMyAdmin-5.1.1-all-languages.zip
a /usr/share/phpmyadmin
mv phpMyAdmin-5.1.1-all-languages /usr/share/phpmyadmin
Cambiar los permisos de /usr/share/phpmyadmin
para el usuario www-data
y el grupo de trabajo www-data
chown -R www-data:www-data /usr/share/phpmyadmin
Posicionarnos en el directorio /etc/apache2/conf-available/
cd /etc/apache2/conf-available/
Crear el archivo phpmyadmin.conf
en /etc/apache2/conf-available/
nano /etc/apache2/conf-available/phpmyadmin.conf
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
<IfModule mod_php.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>
Activar la configuración
sudo a2enconf phpmyadmin.conf
Crear un directorio dentro de /var/lib/phpmyadmin/tmp
mkdir -p /var/lib/phpmyadmin/tmp
Cambiar los permisos del directorio /var/lib/phpmyadmin/tmp
chown www-data:www-data /var/lib/phpmyadmin/tmp
Reiniciar el servicio del Apache2
systemctl reload apache2 o también /etc/init.d/apache2 reload
Corregir error de logeo del usuario root y phpmyadmin
crear usuario y contraseña para el usuario phpmyamdin
mysql -u root
CREATE DATABASE phpmyadmin DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON phpmyadmin.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'debian';
FLUSH PRIVILEGES;
EXIT;
Otorgar todos los permisos al usuario root
mysql -u root -p
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'debian' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;