Difference between revisions of "EWEB2"
(→Administer MySQL through PHP MyAdmin) |
|||
Line 1: | Line 1: | ||
+ | ==Installing MySQL== | ||
+ | |||
+ | As root perform | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ yum install mysql mysql-server | ||
+ | </source> | ||
+ | |||
+ | Next configure mysql by issuing | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ /usr/bin/mysql_secure_installation | ||
+ | </source> | ||
+ | |||
+ | Give a password you can remember for the root user and accept the default for the rest. | ||
+ | |||
+ | Next configure the mysqld to start with the server start: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ chkconfig --list|grep mysql | ||
+ | </source> | ||
+ | |||
+ | expect a result like this: | ||
+ | <source lang="text"> | ||
+ | mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off | ||
+ | </source> | ||
+ | |||
+ | Now configure the mysql daemon to start with Linux boot: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ chkconfig --level 345 mysqld on | ||
+ | </source> | ||
+ | |||
+ | this instructs Linux to start mysqld in run-level 3, 4 and 5. | ||
+ | |||
+ | Finally start the daemon manually for the first time: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ service mysqld start | ||
+ | </source> | ||
+ | |||
+ | Test that you can login by issuing: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ mysql -p | ||
+ | </source> | ||
+ | |||
+ | give the previously set password. To quit from the mysql console type | ||
+ | |||
+ | <source lang="mysql"> | ||
+ | quit; | ||
+ | </source> | ||
+ | |||
==Install PHP== | ==Install PHP== | ||
Revision as of 13:58, 16 January 2014
Contents
Installing MySQL
As root perform
$ yum install mysql mysql-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.
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.
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.104/info.php
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 PHP MyAdmin
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
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.