MySQL

A MySQL database server is installed in the CECS department for use in database classes. This page is provided to assist students with connecting to the database server.

Server information

Here is the information you will need about the MySQL installation:

MySQL Windows Client

The CECS MS Windows computers have a MySQL client program installed that you can use to access the database server. The client application is called MySQL Query Browser and can be found in the available programs listed in the Start Menu.

To connect with the database server you will need to supply the information list above for the MySQL server and also the name of the user and password for the user. The name of the default schema to use is the same as the name of the user.

The first time a student connects with the server, each user must issue a statement to create a database. This needs to be done only once. Each user will then use that database to hold all their tables. Once the application is ready to accept commands, enter the following command to create the database CREATE DATABASE username; The username is the one used to connect with the database. Student accounts are not able to create other databases.

MySQL Linux Client (Remote access)

Connecting to MySQL server from a CECS Linux session

By using the Linux client, users may connect with the MySQL database server from a remote location. First, the user must create a SSH (secure shell) connection to a CECS department Linux computer. This is done by first creating an SSH connection to heart.cecs.csulb.edu and once there entering the command ssh linux. Once logged in to a CECS Linux computer, you can connect to the MySQL database server by using the command: mysql -h infoserver.cecs.csulb.edu -D username -u username -p Where, again, username is the name that you are assigned and the same as the one you use to connect using the MySQL Windows client. You will then be prompted for the MySQL password. If authenticated correctly, the user is then given a MySQL prompt mysql> and can start issuing commands.

Connecting to MySQL server via SSH Tunneling

The MySQL server accepts only connections from computers local to the CSULB network. This is done for security reasons. There is no way to directly connect to it from your own computer, but you can connect to it via a secured connection using what's known as SSH Tunneling.

First, download and install the MySQL Query Browser. You'll be able to download a bundle of tools including the MySQL Query Browser.

To access the MySQL server you will need to use a secure connection to the CECS network, so you'll need an SSH client. You can read about Secure Shells at WikiPedia. There are many SSH clients out there, if you don't already have one, you can get the one installed in the CECS Windows Labs from SSH Communications Security: Download the SSH Secure Shell Client (Windows executable).

Now that you have installed both the MySQL Query Browser and the SSH client, you'll need to configure SSH tunneling.  Here are the basic steps you'll need, for more details, read the page documenting how to set up SSH Tunneling. These steps must be done in this order!

  1. Set up an SSH Tunnel so that local requests to port 3306 are directed via a secured connection to heart.cecs.csulb.edu. You need to configure it as in the figure labeled "Figure : Forwarding to a third host". To do that be sure you specify infoserver.cecs.csulb.edu as the destination host when you create the Outgoing Tunnel. Save the profile and exit the SSH Client application. This only needs to be done once as long as you save the configuration.
  2. Start the SSH Client again and connect to heart.cecs.csulb.edu
  3. Start the MySQL Query Browser and connect to your local computer by entering 127.0.0.1 where you would usually enter infoserver.cecs.csulb.edu. All other information is the same as what you supply when you use it in the lab.
  4. If everything is configured correctly, then you'll be able to connect to the MySQL server and you won't notice any difference in using the MySQL Query Browser application. All information is being tunneled through heart (sshdserver) to infoserver (appserver).
  5. When you are done... just quit the MySQL Query Browser application, and then disconnect and quit the SSH client. 

Database Resources