Spring Term 2012 DATA MODELLING AND DATABASES Setting up the Sample Database 1 Local installation of MySQL You need to have superuser access for Linux or administrator rights for Windows to be able to install the MySQL as a Service using the following commands 1.1 Installing MySQL a) Linux 1. Install the MySQL Community Server using your package manager • Ubuntu/Debian apt-get install mysql-server • Fedora/Redhat yum install mysql-server 2. Get the MySQL Worbench tools for your distribution from http://www.mysql.com/downloads/workbench/ • Install the downloaded package using your package manager • Ubuntu/Debian dpkg -i mysql-workbench-version nr.deb or if you are missing dependencies and don’t want to install them manually gdebi mysql-workbench-version nr.deb • Fedora/Redhat yum localinstall mysql-workbench-version nr.rpm b) Windows 1. Get and install the MySQL Community Server from http://dev.mysql.com/downloads/mysql/ • You can choose the typical installation • Select the Standard Installation if this is the first time you install MySql 2. Get and install the MySQL Worbench from http://dev.mysql.com/downloads/workbench/5.2.html b) Mac OS X 1. Get and install the MySQL Community Server from http://dev.mysql.com/downloads/mysql/#downloads choose the right DMG version to match your machine type and OS X version, for example Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive 2. Get and install the latest DMG version of MySQL Worbench from : http://dev.mysql.com/downloads/workbench/5.2.html 1.2 Import the Sample Database This step is independent of the operating system. 1. Open the MySQL Workbench tool and add you mysql instance • Click on New Server Instance • Select the localhost connection and just leave the default settings. • For Linux installations, make sure that you check your correct Operating System and the MySQL Installation type. • Once the server instance is added you can start and stop your MySQL instance 2. Go back to the MySQL Workbench home screen and click on Open Connection to Start Querying 3. Download the dmdb.sql schema from the lecture webpage and import it to the database. 4. Click on File->Open Sql Script and select the dmdb.sql 5. Select an existing schema or create a new one 6. Click on Query->Execute(All or Selection) and wait until the schema is populated 2 Using the ETH MySQL Service If you don’t want to install MySQL on your computer then you can use the service provided by ETH. Since it is a pretty old MySQL version you might have some limitations. One of these is the incompatibility between MySQL Workbench and the MySQL version offered by the ETH Service. 1. Login to http://www.passwort.ethz.ch with your nethz-Account. 2. Click on Meine Services and then click on MySQL. 3. Choose a Passwort, if possible not the same with your nethz-Passwort. 4. Click on Datenbank erstellen to setup your database. 5. Go to the following website https://phpmyadmin.ethz.ch/appl and register with nethz-username and the password chosen at step 3 6. Click on Import. Download the dmdb.sql schema from the lecture webpage and import it to the database. 7. You are now done and can start running queries on the database :) ! 3 Labs with MySQL installed The student labs in CAB H56 and CAB H57 have MySQL client tools installed. Page 2