Each student in the course is assigned a user name and password to the MySQL database engine on rosemary. Additionally a unique database has been created for each student. The user name and password are the same and each is identical to the student's login name on rosemary.
The list will be available in class. Find the entry that matched your login name in the list. Remembering the user name and password should be easy, and you'll also have to remember the name of your database. No one may access that database without using your user name and password.
The program mysql is a client to the MySQL server. To access your data base enter the following at a $ prompt
mysql -u username -p and then press Enter
You'll be prompted for your password. Type it in and press Enter. If all goes well you'll then be connected to the server.
Here's an example. The user name in this case is ernie, the password is (can't tell you!), and the database is errniedb.
$ mysql -u ernie -p
Enter password: **************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 345 to server version: 3.23.42
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use erniedb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
At this point the user ernie can use SQL to work with existing tables or create tables in the database named erniedb.
To exit the MySQL monitor enter
quit
You will need to know the host name, the user name, the password, and the database name to connect to a MySQL database using PHP function calls. Make substitutions in the code below for your situation.
First create a file named dbinfo.php similar to the one below, substituting the appropriate strings for your user name and password. In this example the user name is mwash9ux, the password is the same, and the database is 470m0399.
<?php
$dbhost = 'localhost';
$dbuser = 'mwash9ux';
$dbpass = 'mwash9ux';
$dbname = '470m0399';
?>
Now, assuming that the file dbinfo.php is in the same directory as a PHP script that needs to use the database 470m0399, the following can be used to connect the database in the script.
include('dbinfo.php');
$conn = @mysql_connect( $dbhost, $dbuser, $dbpass );
if ( !$conn ) {
echo("<p> Unable to connect
to the database system" .
" Please try later. </p>");
exit();
}
//Select the appropriate database
if ( ! @mysql_select_db($dbname) ){
echo("<p> Unable to connect
to the fortune database" .
" Please try later. </p>");
exit();
}
At this point you'll be using SQL with PHP functions as in the examples in the text.

.