You are on page 1of 16

WEB & MYSQL

User Guide
CONTENTS

1. INTRODUCTION ........................................................................................... 1
1.1 CSDM-WEBDEV ....................................................................................... 1
1.2 CSDM-MYSQL ......................................................................................... 1

2. WEBSITES .................................................................................................... 2
2.1 Uploading Files onto Website .................................................................... 2
2.1.1 Connecting using Start Menu .......................................................... 2
2.1.2 Connecting Manually ...................................................................... 2
2.2 Passwords .............................................................................................. 4
2.3 Viewing the Website ................................................................................ 4
2.4 Disk Space ............................................................................................. 4

3. MYSQL DATABASES ...................................................................................... 5


3.1 Connect to MySQL Database ..................................................................... 5
3.1.1 Connecting using phpMyAdmin ........................................................ 5
3.1.2 Connecting using MySQL Client ....................................................... 6
3.1.3 Connecting using TOAD .................................................................. 6
3.2 Passwords .............................................................................................. 8
3.2.1 Changing MySQL Password using SQL .............................................. 8
3.3 Create Databases .................................................................................... 9
3.3.1 Create Databases using phpMyAdmin ............................................... 9
3.3.2 Create Databases using SQL ......................................................... 10
3.4 Delete Databases .................................................................................. 11
3.4.1 Delete Databases using SQL ......................................................... 11
3.5 Exporting Databases .............................................................................. 12
3.5.1 Export using phpMyAdmin ............................................................ 12
3.5.2 Export using Toad........................................................................ 12
INTRODUCTION
1
1. INTRODUCTION
There are 2 servers used for web programming and MySQL database teaching.

1.1 CSDM-WEBDEV
CSDM-WEBDEV server is used for Web Programming modules. It is a web development
server and is not visible outside the university ie. it cannot be accessed from home.
Only students doing Web Development modules or projects will be given access to CSDM-
WEBDEV.
Software Versions
IIS 7.5
PHP 5.3

1.2 CSDM-MYSQL
CSDM-MYSQL server is used for MySQL Database modules. It is a development server and
is not visible outside the university.
Only students doing database modules or projects will be given access to CSDM-MYSQL.
Software Versions
MySQL 5.5

1
WEBSITES

2. WEBSITES
2.1 Uploading Files onto Website
To transfer files onto the website, you need to map a drive to the server. This will
assign a drive letter and allow you to transfer files in the same manner as if you were
copying files onto a USB pen or similar.

2.1.1 Connecting using Start Menu


To make things easier we have created a shortcut on the Start Menu to automatically
connect to your web space.

Connect to CSDM-WEBDEV web space


1. Click Start -> All Programs -> Network -> CSDM-WEBDEV Webspace

You should not see a Q: drive appear in your file explorer. If it does not, then you do
not have a CSDM-WEBDEV account. Contact your lecturer or the support team.

2.1.2 Connecting Manually


You can also manually connect to your web space by using the Windows Map Drive.

Connect to CSDM-WEBDEV web space


1. Open Windows Explorer (not Internet Explorer)
2. In the left pane, Click Computer

3. In the Explorer toolbar, click Map network drive

A Map Network Drive dialog should now appear


4. In Drive:, select Q:

2
WEBSITES

5. In Folder: type \\csdm-webdev\www\<username>


For example, user 01234567 would type:
\\csdm-webdev\www\01234567

6. Click Finish

You should now see a Q: drive appear in your explorer.

Note: You do not have to select the letter Q:, any drive letter will do as long as it is not
already in use.

3
WEBSITES

2.2 Passwords
The password to connect to your web space is the same as the one you log onto the
network with. When you connect to the web space, you should not be prompted for a
password as long as you are logged into the network.
When testing your websites, Internet Explorer should not prompt you for a password.
However, other browsers such as Firefox may ask for your username and password. Use
the same details as you log into the PCs with.
It should be noted that MySQL passwords are completely different from your standard
network username and passwords. See Section 3.2 for more info.

2.3 Viewing the Website


Viewing your website is exactly the same as viewing any website on the Internet.

View website
1. Open Internet Explorer or other Internet browser
2. Enter the url http://csdm-webdev.comp.rgu.ac.uk/<username> and
press <return>. Example: If my username was 01234567, I would enter
http://csdm-webdev.comp.rgu.ac.uk/01234567

3. If prompted for a password, in Username:, enter your username


4. In Password:, enter your password.
5. Click OK
If you are prompted for a password, you should only be asked once as long as you do
not close the browser.

Note: Websites hosted on CSDM-WEBDEV can only be viewed from within RGU. They are not
visible to the outside world.

2.4 Disk Space


All students have a limit of 100MB space on CSDM-WEBDEV. This disk quota will not be
increased without proof that it is needed.

Important! Only files related to web development modules or projects should be put onto CSDM-
WEBDEV. All other files will be removed.

4
MYSQL DATABASES

3. MYSQL DATABASES
3.1 Connect to MySQL Database
There are 4 main ways to connect onto MySQL server.
PhpMyAdmin
MySQL Client
Toad for MySQL
Database Browser

3.1.1 Connecting using phpMyAdmin


PhpMyAdmin is a web interface to make administration of MySQL databases easier. It is
by far the most common way of managing databases out in the real world.

Connect using phpMyAdmin (Start Menu)


1. Click Start -> All Programs -> Network -> CSDM-WEBDEV phpMyAdmin

2. In username, enter your username


Example: If my username is 01234567, I would enter 01234567

3. In password, enter your MySQL server password.

4. Click Go
Alternatively, you can simply enter the URL into the web browser instead and login as
described above.

Connect using phpMyAdmin (URL)


1. Open a web browser such as Internet Explorer or Firefox.
2. Enter the url http://csdm-webdev.comp.rgu.ac.uk/phpmyadmin and press
<return>

5
MYSQL DATABASES

3.1.2 Connecting using MySQL Client


The MySQL client is the most basic way to connect onto MySQL. Everything you do must
be done via command line.

Connect to CSDM-MYSQL database


1. Click Start button
2. In the Search box, enter cmd
3. Click on cmd.exe
4. In the Command Prompt, type
mysql hcsdm-mysql u<username> -p
Example: If my user id is 01234567, I would enter

mysql hcsdm-mysql u01234567 p

5. When prompted, enter your MySQL server password.


You should now see a mySQL> prompt

3.1.3 Connecting using TOAD


TOAD is a MySQL front end. It simply makes doing operations in MySQL easier.

Connect using TOAD


1. Click Start -> All Programs -> Database -> Toad for MySQL

2. Click Connect icon

Create New Connection window should now appear


3. In Host:, enter csdm-webdev

6
MYSQL DATABASES

4. In User:, enter your username


Example: If my username is 01234567, I would enter 01234567

5. In Password, enter your password.

6. Click Connect

You should now connect. To select the database you wish to work on, use the pull-down
menu in the Object Explorer pane on the left.

7
MYSQL DATABASES

3.2 Passwords
Unlike most other systems in the university, the MySQL password is completely separate
from all other passwords. This is to prevent you having to enter your network password
in clear text in source code files, such as php files.
The default password for logging onto MySQL Server is your username (matric number).
For example, if my network login is 01234567, then my password would also be
01234567.
Staff must contact the support team to receive their passwords.

Important! It is essential that you change the default password to something more secure as
soon as you have connected to MySQL.

3.2.1 Changing MySQL Password using SQL


To change the MySQL Password, you need to use the SET PASSWORD command.
SET PASSWORD FOR '<User>'@'%' = PASSWORD('<password>');
For example, if my username was 01234567 and I wanted to use the password elephant,
I would enter:
SET PASSWORD FOR '01234567'@'%' = PASSWORD('elephant');

Important! Ensure no one is looking over your shoulder when you type this command. Your
password is in clearly visible.

8
MYSQL DATABASES

3.3 Create Databases


Students doing database modules should already have the necessary database files
created. Unless the administrators have been told otherwise, the standard database
name for a module with be db<username>_<module>. For example, if user 01234567
is doing a database module CM3028, they should already have a database called
db01234567_cm3028.
Students can also create their own databases. However, this should only be done if
absolutely necessary. If we encounter users creating excessive databases, the user will
be disabled. If you create databases for testing purposes, ensure you delete (drop) them
afterwards.

3.3.1 Create Databases using phpMyAdmin


phpMyAdmin has a GUI interface that allows the creation of databases without having to
know the SQL command.

Create Database using phpMyAdmin


1. Log in MySQL with phpMyAdmin (See Section 3.1.1)
2. Click the Home icon in top left panel

3. Click Databases tab

4. In Create new database enter db<username>_<name>


Example: If my user id is 01234567 and I want to create a database called
QVan, I would enter db01234567_QVan.

Note! All databases must with the letters db followed by your username.
ie. db<username>_

5. Click Create

9
MYSQL DATABASES

3.3.2 Create Databases using SQL


To create a database using SQL, use the following command:
CREATE DATABASE db<username>_<name>;
For example, if my user id is 01234567 and I want to create a database called QVan, I
would enter:
CREATE DATABASE db01234567_QVan;
All databases must with the letters db followed by your username.

Note! All databases must with the letters db followed by your username.
ie. db<username>_

10
MYSQL DATABASES

3.4 Delete Databases


Once you start creating multiple databases, youll want to delete old databases at some
point. In MySQL, when you delete a database, it is referred to as dropping a database.

3.4.1 Delete Databases using SQL


To create a database using SQL, use the following command:
DROP DATABASE <database>;
For example, if I had a database called db01234567_QVan, I would enter:
DROP DATABASE db01234567_QVan;

11
MYSQL DATABASES

3.5 Exporting Databases


Its often useful to backup you databases onto your H:\ drive or make a backup to take
home.

3.5.1 Export using phpMyAdmin


phpMyAdmin has an export feature built into it.

Backup Database phpMyAdmin


1. Log in MySQL with phpMyAdmin (See Section 3.1.1)
2. Click on the database you wish to backup in the left column. Example: If I
wanted to backup the database db01234567_db, click it in the left column.

3. Click Export tab at top

4. In Format:, ensure SQL is selected

5. Click Go
6. Select where to save the database .sql file to and click Save

3.5.2 Export using Toad


Toad has an export wizard. TOAD only exports that database structure and contents
only. The database must exist to import it back in.

Backup Database using TOAD


1. Log onto MySQL using TOAD (See Section 3.1.3)
2. Click Tools -> Export -> Export Wizard

12
MYSQL DATABASES

The Data Export Wizard should now appear.


3. In Welcome to the Data Export Wizard, click Next
4. In Export Object, Click Add
Select Objects window will now appear
5. In Export Category, click Databases

6. In Databases:, tick the databases you wish to back up. For example, if we
wanted to export the database db01234567_db then we would tick it.

7. Back in Databases in the left side, ensure Tables is ticked (and tick Views if
required).

8. Click Next
Select Output Format window should now appear
9. From the Output Format pull-down menu, select SQL Script

10. Click Next


Select Columns window should now appear
11. Ensure all columns are selected and click Next
Select Output Options window should now appear
12. Click button to specify the path to save the file

13
MYSQL DATABASES

13. Select the folder where to save the database .sql file to and click OK
14. Click Next
Export Object window should now reappear
15. Click Next

Save Settings as Template window should now appear


16. Click Finish

14

You might also like