mySql primer
  1. Log onto torvalds.
  2. Start the mySql client as mysql -p -h compsci.bearlabs.uncw.edu -u yourUserName. Log in to the mySql server using your assigned password that Allen has emailed you at your UNCW email account. Each student has a separate database account. So your database will not conflict with other student databases.
  3. show databases; will show all available databases. You will notice that one of the databases is named with your username.
  4. Connect to your database using use databaseName;, as in use abc1234;
  5. Create one or more tables and add data to the tables. See course Web site and chapter 4 in your book for examples. Note that strings are specified in single quotes. Each sql statement is terminated by a semi-colon.
  6.         create table customer
               (customerName char(20) not null,
                 customerStreet char(30),
                 customerCity char(30),
                 primary key (customerName));


            insert into customer
                values('Smith', 'Pine', 'Wilmington');
  7. Write queries to retrieve data from the tables. As in, select * from customer;
  8. Type exit to leave the mysql client.
  9. At the mySql prompt you can use source inputFileName to have the mySql server read and execute the sql commands contained in the specified file.
  10. At the mySql prompt you can use tee outputFileName to have the mySql server direct all output to the specified file.Use notee to reset output to the standard output.
  11. At the mySql prompt type in help for a list of mySql server commands.
  12. At the mySql prompt you can use set password = password("newPassword"); to change your mySql password.