Mainos / Advertisement:

Phpmyadmin

From Taisto
Jump to navigation Jump to search
This page is a translated version of the page Phpmyadmin and the translation is 100% complete.

Other languages:
English • ‎suomi

Phpmyadmin is a useful application for the administrator of a mysql database. Before installing phpmyadmin, install php5,mysql and apache2. More information on phpmyadmin.

Installation

1. We install phpmyadmin using the command line or by downloading the package online http://www.phpmyadmin.net/

aptitude install phpmyadmin

2. While installing we select the automatic configuration for an apache2 webserver.

Phpmyadmin 1.png

3. We install an automatic database for phpmyadmin.

Phpmyadmin 2.png

4. Give the Mysql ROOT user password.

Phpmyadmin 3.png

5. Give the phpmyadmin user password. You can leave it blank, and a password will be generated.

Phpmyadmin 4.png

6. Confirm password

Phpmyadmin 5.png


You can access the web GUI and use it to administrate your database by:

http://serveraddress/phpmyadmin

Phpmyadmin 6.png

Configuration

By default all configurations are made ready to function in the installation phase.

Phpmyadmin's apache2 configuration files are located in:

 nano /etc/apache2/conf.d/phpmyadmin.conf

AND (both have the same file)

 nano /etc/phpmyadmin/apache.conf 

Contents of the file:

 # phpMyAdmin default Apache configuration
 
 Alias /phpmyadmin /usr/share/phpmyadmin

Alias is a virtual directory where phpmyadmin is located. It is recommended to change the location of the virtual directory to somewhere else, so an attacker who isn't familiar with your configuration will have a harder time to access the phpmyadmin page.

 #<Directory /usr/share/phpmyadmin>
 #       Options FollowSymLinks
 #       DirectoryIndex index.php
 #
 #       <IfModule mod_php5.c>
 #               AddType application/x-httpd-php .php
 #
 #               php_flag magic_quotes_gpc Off
 #               php_flag track_vars On
 #               php_flag register_globals Off
 #               php_admin_flag allow_url_fopen Off
 #               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/
 #       </IfModule>
 #
 #</Directory>
 #

Logging in to the phpmyadmin settings page.

 # Authorize for setup

Settings page physical path:

  <Directory /usr/share/phpmyadmin/setup>
   <IfModule mod_authn_file.c>
   AuthType Basic
   AuthName "phpMyAdmin Setup"

Password file location:

   AuthUserFile /etc/phpmyadmin/htpasswd.setup
   </IfModule>
   Require valid-user
 </Directory>

Block access to the phpmyadmin system directories when they are not required.

 # 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>

Several MySQL servers for Phpmyadmin

Add the following configurations to the /etc/phpmyadmin/config.inc.php after the next configurations:

/*
* End of servers configuration
*
*/

This:

 $i++;

$cfg['Servers'][$i]['verbose'] = 'Database Server 2'; #Database server name, which is used for authentication

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '10.5.2.5'; #server IP-address, you can use a DNS name but it might be slow
$cfg['Servers'][$i]['connect_type'] = 'tcp';
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser; #phpmyadmin database username
$cfg['Servers'][$i]['controlpass'] = $dbpass; #phpmyadmin database password
/* Optional: Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; #phpmyadmin database name
$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]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/*
* End of servers configuration
*/

Test functionality by using your web browser to navigate to phpmyadmin. Now you should see the servers listed.

Phpmyadmin multiple server login.png

Additional information

https://www.omaserveri.info/asenna-phpmyadmin-ubuntuun/ (Finnish)

Mainos / Advertisement: