Skip to main content

Installing mySQL in Ubuntu

June 28, 2008

Install

apt-get install mysql-server mysql-php5 phpmyadmin

Setup Apache for phpmyadmin

  • Copy conf file from phpmyadmin to sites-enabled directory
cp /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/
vi /etc/apache2/sites-available/apache.conf
  • Sample conf setup for virtual host
<VirtualHost *>
ServerName mysql.dilucidate.com
DocumentRoot /usr/share/phpmyadmin
ServerAlias mysql.dilucidate.com
<Directory /usr/share/phpmyadmin>
        Options Indexes FollowSymLinks
        DirectoryIndex index.php
        
        # Authorize for setup
        <Files setup.php>
            # For Apache 1.3 and 2.0
            <IfModule mod_auth.c>
                AuthType Basic
                AuthName "phpMyAdmin Setup"
                AuthUserFile /etc/phpmyadmin/htpasswd.setup
            </IfModule>
            # For Apache 2.2
            <IfModule mod_authn_file.c>
                AuthType Basic
                AuthName "phpMyAdmin Setup"
                AuthUserFile /etc/phpmyadmin/htpasswd.setup
            </IfModule>
            Require valid-user
        </Files>
        <IfModule mod_php4.c>
                AddType application/x-httpd-php .php

                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_value include_path .
        </IfModule>
        <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_value include_path .
        </IfModule>
</Directory>
</VirtualHost>
ln -s /etc/apache2/sites-available/mysql.conf /etc/apache2/sites-enabled/mysql.conf
  • Restart apache
/etc/init.d/apache2 restart