Question: Start the database: systemctl start mariadb Login to the database: mysql - u root Set a password for root: set password = password (
Start the database: systemctl start mariadb
Login to the database: mysql u root
Set a password for root: set password passwordpasswrd;
Create a database called addressbook: create database addressbook;
Make the addressbook database the current database: use addressbook;
Create a table called address: CREATE TABLE address id INT NOT NULL AUTOINCREMENT PRIMARY KEY, lastname VARCHAR firstname VARCHAR phone VARCHAR email VARCHAR;
Create a user to be used from the web application and set the password: create user www@'localhost' identified by 'wwwUSERpass';
Give the www user permissions to the table: grant select, insert, delete, update on address to www@'localhost';
Type quit to get out of mysql
Edit varwwwhtmlrdsconf.php to set the connection to match the settings you just created. The database is on the local server so the $RDSURL variable should be set to localhost. $RDSDB should be set to the name of the database you created. $RDSuser should be set to the name of the user you created to use from the web application. $RDSpwd should be set to the password you gave the user when you created it
Restart httpd
Access the webapp by putting the IP address or dns name of your server followed by addressbookphp in the browser. Did it work? It should show you a table and a link to add a contact. If you just put your IP address or domain name it will likely show you the index.html from the earlier learning module. If it did not work, check the troubleshooting steps below.
Once you get the Add Contact link test by adding a few records to your address book.
Make sure you have made the necessary modifications to have mariadb start at boot.
Edit varwwwhtmlrdsconf.php to set the connection to match the settings you just created. The database is on the local server so the $RDSURL variable should be set to localhost. $RDSDB should be set to the name of the database you created. $RDSuser should be set to the name of the user you created to use from the webapp. $RDSpwd should be set to the password you gave the user when you created it
There are the variables that need to be set:
$RDSURL
$RDSDB
$RDSuser
$RDSpwd
$RDSURL is where the database is running and I told you what to set for that.
For the other I said to make sure they match what was configured in the database. Here are the commands where you should get the needed information:
create database addressbook;
create user www@'localhost' identified by 'wwwUSERpass';
The user is www not www@localhost.
;
includerdsconf.php;
Set address book variables
isset$REQUESTmode $mode$REQUESTmode : $mode;
isset$REQUESTid $id$REQUESTid : $id;
isset$REQUESTlastname $lastname$REQUESTlastname : $lastname; isset$REQUESTfirstname $firstname$REQUESTfirstname : $firstname; isset$REQUESTphone $phone$REQUESTphone : $phone;
isset$REQUESTemail $email$REQUESTemail : $email;
Connect to the RDS database
$connectmysqliconnect$RDSURL, $RDSuser, $RDSpwd or diemysqlierror$connect;
mysqliselectdb$connect, $RDSDB or diemysqlierror$connect;
if $mode"add"
Print
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
