Table of Contents

Install MySQL database

Installation

apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

Assign a root password when asked for during the installation. When the installation is finished, restart the apache2 server:

/etc/init.d/apache2 restart

Install phpMyAdmin

apt-get install phpmyadmin
  1. Install your favourite distribution of phpMyAdmin in a directory you like. I installed mine at /usr/share/phpMyAdmin.
  2. The privileges for the directory will be 755 with root user and group.
  3. Go to /etc/httpd/conf.d directory and create a file with the name phpMyAdmin.conf (anything with the .conf extension will be parsed by Apache) and write a simple command: Alias /phpMyAdmin /usr/share/phpMyAdmin
  4. Go to the directory you installed phpMyAdmin (/usr/share/phpMyAdmin), edit the config.inc.php file, and you are ready.
  5. $cfg['Servers'][$i]['controluser'] and $cfg['Servers'][$i]['controlpass'] can be blank.
  6. You or anybody can now login from ANY of your domains to phpMyAdmin, either as the root mySQL user (username: admin, password: the one you entered when you bought the server), or the specific user with priviledges only to his own databases, entering: www..com/phpMyAdmin

Restrict access to PhpMyAdmin to local network

Enter the following lines to phpmyadmin.conf in the /etc/apache2/conf.d

Order deny, allow
Deny from all
Allow from localhost 127.0.0.1 192.168.1.*

add user and new database

with password:

shell> mysql -u root -p

without password:

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

then:

mysql> CREATE USER 'user1'@'localhost' IDENTIFIED BY 'pass1';
mysql> CREATE database petstore;
mysql> SHOW databases;
mysql> USE database;
mysql> SHOW tables;