- Log onto torvalds.
- 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.
- show databases; will show all available databases.
You will notice that one of the databases is named with your username.
- Connect to your database using
use databaseName;, as in use abc1234;
- 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.
create table customer
(customerName char(20) not null,
customerStreet char(30),
customerCity char(30),
primary key (customerName));
insert into customer
values('Smith', 'Pine', 'Wilmington');
- Write queries to retrieve data from the tables. As in, select * from customer;
- Type exit
to leave the mysql client.
- 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.
- 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.
- At the mySql prompt type in help for a list of mySql server commands.
- At the mySql prompt you can use set password = password("newPassword"); to change your mySql password.