This document is designed to get you started when you have a database set up for you on the publicdb machine.
There are no logins on the machine itself, everything is done via the client programs (mysql and mysqladmin), or a local GUI, such as the local instance of phpMyAdmin we offer.
Changing Your Password
When your database is generated, it is given a randomly-generated password, which is mailed to you in plaintext. You'll probably want to reset it (note: in the following examples, soak is used as the client, but any machine on the department network will work, as long as it has the mysql client utilities).
|
where:
<username> is your user name,
<database> is your database name, and
<newpasswd> is your new password.
Note you can use phpMyAdmin for this as well.
After you do this, all further mysql or mysqladmin commands will require:
"-h publicdb -u <username> -p" |
Note that anything using the "-p" by itself on the command line will prompt you for your password after you hit "Enter".
Connecting To Your Database
To connect to your database, you would type:
soak:$ mysql -h publicdb -u <username> -p <database> |
where:
<username> is your username, and
<database> is the database name (they are probably the same).
After you enter your password at the prompt, you'll be in the mysql command-line utility.
Backups
While this server is backed up nightly, you can periodically back up your own database by using the "mysqldump" command:
soak:$ mysqldump -h publicdb -u <username> -p <database> > <filename> |
Getting Started with PHP
Here is some sample code to access the database via PHP:
|
You can get more information here [PHP Reference Manual].
Access Via C/C++
MySQL client libraries are available in your environment.
Access Via Java
Your database can also be accessed via your java programs via the mysql connector library, which is installed on our public cycle servers in /usr/share/java. The jar file is mysql-connector-java.jar, and further documentation can be found in the /usr/share/doc/mysql-connector-java-[VERSION] directory. Note that you need to set your CLASSPATH appropriately.