Courant offers users the ability to set up databases on its central database server, warehouse.cims.nyu.edu. The Database Manager should be used to set up your database. Databases stored on this system will provide automatic backup along with automatic database restarts in the event of server downtime. If you need help with a self administered database currently running on a courses/linserv machine, please refer to the old database instructions.
Using the Database Manager
The database server requires a special account to connect. Accessing the Database Manager will automatically create your database account. You still need a special database password to connect to your databases, however. To set your database password, click on the "Reset Database Password" button in the Database Manager. The new password will then appear on the screen in green. This button can also be used if you lose your database password.
After resetting your password, you can create a database by clicking on "Add New Database". This will take you to a new screen where you can enter your database name. The database name may only consist of letters, numbers, and underscore. Click "Create" to complete the creation of the database.
The Database Manager will automatically prepend your CIMS login to the database name. So if your CIMS login is "smith", and your database name is "data1", the full database name will be "smith_data1".
Accessing the Database
Once your databases are created, they can be accessed with the following command from any Unix machine on the CIMS network:
/usr/local/pkg/mysql/bin/mysql -hwarehouse -p
You will be prompted for your database password (not your CIMS password).
You can then change your password by entering:
set password = password("new-password");
Your database password should not be the same as your regular CIMS password.
For convenience, Courant offers phpMyAdmin to administer your databases. You can login with your CIMS login and your Database password.
Migrating From a Self Managed Database
If you would like to migrate from a courses/linserv database to the new hosted system, please see the database migration guide.
Sample PHP Code
$db_type = "mysql";
$db_server = "warehouse.cims.nyu.edu";
$db_name = "your_database_name";
$db_user = "your_cims_login";
$db_password = "your_database_password";
$db_link = mysql_connect($db_server, $db_user, $db_password);
die("Could not connect: " . mysql_error());
echo nl2br("Connected successfully\n");
$db_selected = mysql_select_db($db_name, $db_link);
die("Can't use \"$db_name\" : " . mysql_error());
echo nl2br("Selected successfully\n");