EWEB2
Installing MySQL
With your team prepare your virtual server for running MySQL by following the steps below.
Install the server
As root perform
$ yum install mysql mysql-server
Secure the server
Next configure mysql by issuing
$ /usr/bin/mysql_secure_installation
Give a password you can remember for the root user and accept the default for the rest - but DO READ and understand what you're accepting.
Make mysqld start with Linux
Next configure the mysqld to start with the server start:
$ chkconfig --list|grep mysql
expect a result like this:
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Now configure the mysql daemon to start with Linux boot:
$ chkconfig --level 345 mysqld on
this instructs Linux to start mysqld in run-level 3, 4 and 5. MySQL will now start every time you (re)boot your computer.
Check that you've enabled the mysqld
$ chkconfig --list|grep mysql
expect a result like this:
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Manually start the daemon
Finally start the daemon manually for the first time:
$ service mysqld start
Test that you can login by issuing:
$ mysql -p
give the previously set password. To quit from the mysql console type
quit;
Install PHP
In order to use PHP in the web server, you have to install PHP.
As root perform:
$ yum install php
$ service httpd restart
The last line is to restart the Apache server loading the newly installed module.
Test the PHP installation
In the web-server root (typical /var/www/html) create a file info.php with this content:
<?php phpinfo(); ?>
Next test that your web-server and PHP is running as expected by entering in your web-browser the IP-address of your virtual server and /info.php like:
10.1.18.nnn/info.php
where you replace nnn with your virtual computers IP address.
Get in contact with MySQL
As root install support for the MySQL database by issuing:
$ yum install php-mysql
Restart the httpd server.
Reload the info.php page and observe that you now have a section about MySQL.
Administer MySQL through PHPMyAdmin
PHPHMyAdmin is a web based application enabling you to manipulate the MySQL database.
Installation
First ensure that you have mysql and the mysql server installed.
$ yum install mysql mysql-server
$ service mysqld start
Install phpmyadmin by, as root, issuing this command:
$ yum install phpmyadmin
Configuration
Next you have to configure the phpmyadmin a little:
In /etc/http/conf.d/phpmyadmin.conf comment out the <Directory "/usr/share/phpmyadmin"> stanza ending up with something like this:
# But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin #<Directory /usr/share/phpMyAdmin/> # Order Deny,Allow # Deny from All # Allow from 127.0.0.1 # Allow from ::1 #</Directory>
Next we check that the authentication in phpMyAdmin is set to http:
Open /usr/share/phpMyAdmin/config.inc.php and look for the line:
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
if the setting is not http change it.
Restart the httpd by issuing:
$ service httpd restart
Testing the PHPMyAdmin installation
Test PHPMyAdmin by using this link phpMyadmin (works only if you're loged in on the development host using a NX terminal).
You may hav eto edit the phpmyadmin configuration file. Add the location og the mysql.sock file.
$ vi /etc/phpMyAdmin/config.inc.php
Find and change the socket setting so it looks like this:
$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock'; // Path to the socket - leave blank for default socket
The path and file name of the mysql.sock file was added.
Be sure to reload the httpd before testing again.