Database Server

Currently, the CSE instructional and production database server is using MySQL 5.0. Several CSE courses use the database in their course work. Students taking these courses will have a database account generated for them automatically at the beginning of the term. The account is removed at the end of the term.

Database Accounts

Accounts on the database servers are generated on an as-needed basis. The login name will be the same as your Linux login name. The default password pattern for the database server is the same as the default pattern for Linux.

MySQL and the CSE Environment

Before using MySQL, you'll need to subscribe to it with the command subscribe MYSQL. You will need to log out and back in for the changes to take effect.

The default databse in the CSE environemnt is the course database server, db1, on port 3307. To change the server, use the -h and -P options: mysql -p -h <server> -P <port>

Accessing the Database

From a Linux prompt, you can connect to the database server with the command mysql -p. The -p options prompts for a password.

When you first connect to the MySQL server, you will start in your default database, usually your course database. If you are enrolled in more than one course that requires the use of a database, you can switch between databases with the use command. Databases names take the form <class_section>_<username>. So if user doej wanted to switch to the database for class section c4321aa, she would enter the command use c4321aa_doej at a mysql prompt.

You can run commands in batch mode. SQL commands can be put into a file and the executed from a Linux terminal with the command mysql -p < <file_name>. From within MySQL, you can use the source command.

If you need to save the output of a query, you can redirect it to a file with the into file syntax: mysql> <your_query> into <outfile> <full_file_pat>.

The tee is used to log statements and their output: tee <logfile.txt>;. You can also invoke MySQL from the Linux command line with the --tee option: mysql --tee <logfile.txt>

Another useful command is the ego command. It prints the results of a query vertically, which is helpful for tables with many columns.

Changing Your Password

After connect to the server, you can change your password with the stored procedure set password = password('<new_password>');. Your password will not be hidden or encrypted when changing it with set password, so it is best to ensure that no one is looking over your shoulder.

Forgotten passwords can be reset by visiting the Help Desk with a photo ID.

More Information

Problems connecting to the server or with your account should be brought to the attention of the Help Desk. Be sure to include your MySQL login name and any error messages you receive. Questions or problems with running your coursework should be directed to your instructor.

Help with MySQL is available via the help command, or in the MySQL Documentation

Support CSE

$50,000 for the 50th

Donate to the department to help us reach the goal of $50,000 in donations to celebrate over 50 years of teaching excellence

Click here to make your donation.