Benutzer-Werkzeuge

Webseiten-Werkzeuge


vps:phpmyadmin

phpMyAdmin installieren

Mehr Informationen unter http://www.phpmyadmin.net

Voraussetzungen

  • Betriebssystem mit PHP & 1-Klick-DB Support (siehe Liste)

Install Script

bash.sh
#!/bin/bash
echo -n "IP-Adresse:" 
read IP
cd ~
wget http://netcologne.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.2/phpMyAdmin-4.0.2-all-languages.zip
unzip phpMyAdmin-4.0.2-all-languages.zip
rm phpMyAdmin-4.0.2-all-languages.zip
mv phpMyAdmin-4.0.2-all-languages/ /var/www/dbadmin
mkdir /etc/apache2/ssl
openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -keyout /etc/apache2/ssl/dbadmin.key -out /etc/apache2/ssl/dbadmin.crt
cat << End-of-Vhost > /etc/apache2/sites-enabled/dbadmin
<VirtualHost $IP:443>
  DocumentRoot /var/www/
  SSLEngine on
  SSLCertificateKeyFile /etc/apache2/ssl/dbadmin.key
  SSLCertificateFile /etc/apache2/ssl/dbadmin.crt
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>
End-of-Vhost
PMA_PASSWORD=$(openssl rand -base64 12 | tr -d /+)
cat << End-of-Config > /var/www/dbadmin/config.inc.php
<?php
 
/* Servers configuration */
\$i = 0;
 
/* Server: Localhost [1] */
\$i++;
\$cfg['Servers'][\$i]['verbose'] = 'Localhost';
\$cfg['Servers'][\$i]['host'] = 'localhost';
\$cfg['Servers'][\$i]['port'] = '';
\$cfg['Servers'][\$i]['socket'] = '';
\$cfg['Servers'][\$i]['ssl'] = true;
\$cfg['Servers'][\$i]['connect_type'] = 'tcp';
\$cfg['Servers'][\$i]['extension'] = 'mysqli';
\$cfg['Servers'][\$i]['auth_type'] = 'http';
\$cfg['Servers'][\$i]['user'] = 'root';
\$cfg['Servers'][\$i]['password'] = '';
\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';
\$cfg['Servers'][\$i]['controluser'] = 'pma';
\$cfg['Servers'][\$i]['controlpass'] = '$PMA_PASSWORD';
\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';
\$cfg['Servers'][\$i]['relation'] = 'pma__relation';
\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';
\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';
\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';
\$cfg['Servers'][\$i]['history'] = 'pma__history';
\$cfg['Servers'][\$i]['recent'] = 'pma__recent';
\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';
\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';
\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';
\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';
\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';
 
/* End of servers configuration */
 
\$cfg['DefaultLang'] = 'de';
\$cfg['ServerDefault'] = 1;
\$cfg['UploadDir'] = '';
\$cfg['SaveDir'] = '';
\$cfg['ForceSSL'] = true;
\$cfg['SuhosinDisableWarning'] = 'true';
?>
End-of-Config
rm /var/www/dbadmin/setup/ -R
chown www-data:www-data /var/www/dbadmin -R
/etc/init.d/apache2 restart
echo "Password for PMA-User: $PMA_PASSWORD"

Database Script

bash.sh
#!/bin/bash
cd /var/www/dbadmin/examples
mysql -u root -p
createdb.sql
SOURCE create_tables.sql
GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY '%PMA-USER-PASSWORD%' WITH GRANT OPTION;
FLUSH privileges;
exit

%PMA-USER-PASSWORD% durch das jeweilige „Password for PMA-User“ ersetzen (wird am Ende des Install-Scripts angezeigt).