Howtos phpMyAdmin Basic Installation

From 5dollarwhitebox.org Media Wiki

Jump to: navigation, search

Contents

Summary

So, this isn't really the type of thing that needs a howto... but it is more so I can refer people here... and so I don't have to show them!


Get phpMyAdmin

Download latest from: http://sourceforge.net/projects/phpmyadmin/

linuxbox #] wget http://easynews.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.8.1.tar.gz 

linuxbox #] tar -zxvf phpMyAdmin-2.8.1.tar.gz 

linuxbox #] mv phpMyAdmin-2.8.1.tar.gz /usr/local/phpMyAdmin-2.8.1

linuxbox #] ln -s /usr/local/phpMyAdmin-2.8.1 /usr/local/phpMyAdmin

linuxbox #] mkdir /usr/local/phpMyAdmin/config

linuxbox #] chown apache /usr/local/phpMyAdmin/config

Note: Substitute the actual URL to the latest version of phpMyAdmin... don't copy and paste that line.


Apache Configuration

Add the following to the Global Apache Configuration by creating a file a file in the 'conf.d' include directory (you can also just add it to the httpd.conf or apache2.conf but this way is recommended):

  • RedHat/CentOS/Fedora: /etc/httpd/conf.d/phpMyAdmin.conf
  • Debian/Ubuntu: /etc/apache2/conf.d/phpMyAdmin.conf


Alias /phpMyAdmin "/usr/local/phpMyAdmin"


To be smart and secure, I would recommend something like the following to Force the use of SSL:

<Directory "/usr/local/phpMyAdmin">
      SSLRequireSSL
</Directory>


Restart apache

linuxbox #] /etc/init.d/httpd restart


Configure phpMyAdmin

Configure the Conrol User... First you need to create the phpMyAdmin control user in mysql:

mysql>  GRANT SELECT ON mysql.user TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'password';

mysql>  GRANT SELECT ON mysql.db TO 'phpmyadmin'@'localhost';

For the love of everything sane, please replace 'password' with something random, obscure, stupid... regardless, not 'password'.


Create the config:

linuxbox #] cd /usr/local/phpMyAdmin
linuxbox #] cp -a libraries/config.default.php config.inc.php


Edit '/usr/local/phpMyAdmin/config.inc.php' and modify the following settings:

$cfg['blowfish_secret'] = 'Enter_A_Completely_Random_String';

$cfg['Servers'][$i]['controluser']   = 'phpmyadmin'; 

$cfg['Servers'][$i]['controlpass']   = 'password'; 

$cfg['Servers'][$i]['auth_type']     = 'cookie';


You should now be able to hit phpMyAdmin at http://www.domain.com/phpMyAdmin . Login with a MySQL username/password.



Security

This is very important. If the box does not have a MySQL root password set, then anyone in the world can login to phpMyAdmin with user 'root' and no password and have full access to the database server. THIS IS BAD! If the root password is not set, please set it:


Set MySQL Root Password:

linuxbox /]# mysql

mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('password');

mysql> FLUSH PRIVILEGES

For the love of everything sane, please replace 'password' with something random, obscure, stupid... regardless, not 'password'.


To ease logins if you don't like to use a password, simply create your user's .my.cnf file. Say for root, this would be '/root/.my.cnf':

linuxbox /]# vi /root/.my.cnf

Using VI, and the following:

[client]
user=root
password=password

Where 'password' is the MySQL root user's password.


Secure the file (IMPORTANT):

linuxbox /]# chmod 600 /root/.my.cnf


You can then still access MySQL without typing a password.

Personal tools