Beruflich Dokumente
Kultur Dokumente
Click on Sign In/Register for Account in the top bar. You should see something like this:
If you already have an Oracle account, enter your new username and password, and then click the "Go"
button to continue.
If you don't already have an Oracle account, click on Create your Oracle account now at the bottom of
the right box. You should see something like the following:
Page 1 of 20
CS31A
Type in your email address and a password for your new OTN account.
Click Create Account.
Complete the form and click "Create Account" You will find yourself logged into the OTN.
Click on the Downloads tab to get to the Oracle database downloads.
If you look in the upper left hand corner you should see your first name and Sign Out, which
indicates that you are logged onto OTN.
Click on the Downloads link to download Oracle Database 11g Release 2, or click on one of
the links next to Database to get to the downloads page.
Page 2 of 20
CS31A
There are several versions of MySQL 5.6, and these can be reviewed at www.mysql.com/products/
MySQL Community Server: This is the General Public License (GPL) version of the MySQL
database server, which includes support for both regular, non-transactional storage engines and
transaction-safe tables. It is suited for production environments requiring a stable, flexible, and
robust database engine, and can be downloaded free of charge.
MySQL Enterprise Server: This version is only available as part of the MySQL Enterprise
platform, a commercial offering aimed at enterprise customers with business-critical applications.
It includes all the features of the Community Server, along with automated updates and hot fixes,
consulting support, and monitoring services.
Page 3 of 20
CS31A
Download MySQL-installercommunity.
Page 4 of 20
CS31A
3. Once youve got MySQL downloaded, go through the installation process. It may vary somewhat
depending on platform.
Ive illustrated the basic install on Windows 7 over the next few pages, just to give you an idea of
what you should be seeing.
Page 5 of 20
CS31A
4. Determine the option most compatible with your preferences by reading the Setup Type
Description descriptions.
Page 6 of 20
CS31A
5. On a custom install, youll go through each of the choices on the left menu list. First up will be
setting the features. Selecting which connectors you want loaded.
6. After you select a setup type, the MySQL Installer will check your system for the necessary external
requirements and download then install missing components onto your system
7. The next window lists the MySQL products that are scheduled to be installed
8. As components are installed, you'll see their status change from "to be installed" to "install success."
9. Youre now at the point to download and install the server configuration youve selected. Just click
Execute.
Page 7 of 20
CS31A
13. Select Configuration Type: Development Machine. Check TCP/IP enable. Port will default to 3306,
which is fine. Click Next.
14. You should always set a password for the root account.
15. If the MySQL Server is already installed, then the Current Root Password will also be needed.
16. Next, configure the Windows Service Details. This includes the service name, how the MySQL
Server should be loaded at startup, and how the Windows Service for MySQL Server will be run.
17. We dont need to define any additional user accounts at this point. You can do this later if you wish.
Page 8 of 20
CS31A
Page 9 of 20
CS31A
18. After the MySQL Installer configuration process is completed, you may save the installation log, and
then load MySQL Workbench if the Start MySQL Workbench after Setup option is checked:
Page 10 of 20
CS31A
19. Click Next to begin the MySQL Server configuration. It will start automatically as a service when
this completes.
20. Youre done. The MySQL Server is now running and the MySQL Workbench will start when you
click Finish.
21. This is the MySQL workbench. It is basically waiting for you to select a server to connect to at this
point.
3. Running MySQL
For the examples I use the MySQL command line client that is installed with MySQL. You can use this
command in interactive mode where you enter a query and get a result, then enter another query and get a
result. You can also use the MySQL command line in batch mode where the queries are read from a script
and execute one after the other.
You can do all of your work in the command line client. Some people prefer to work in a graphical
interface (MySQL Workbench).
CS31A
How to start the MySQL monitor from the Windows Start menu
Start All Programs MySQL MySQL Server MySQL Command Line Client
.
The MySQL command-line interface is provided by the MySQL application. Some additional parameters
are required to connect to a database:
Once connected to the DBMS, you will be provided with a prompt at which you can enter MySQL
statements.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.6.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be
trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Page 12 of 20
CS31A
MySQL Workbench
3.2 Using MySQL Workbench
You can do all your work in the command line client but you may find a graphical client helpful. You can
build and test your queries in the graphical client and build up the script. Then run the script to spool
using the command line.
MySQL Workbench is a visual database design tool that integrates SQL development, administration,
database design, creation and maintenance into a single, seamless environment for the MySQL database
system.
What is a MySQL schema?
Schema is MySQLs term for database.
Creating a New MySQL Connection
The SQL Development and Server Administration tools require connections to the database.
1. Open MySQL Workbench by clicking StartAll ProgramMySQLMySQL
Workbench.
2. Having launched the MySQL Workbench, you should now see the following initial
dialog of MySQL Workbench.
New Connection
Page 13 of 20
CS31A
3. The default connection uses localhost, instead of 127.0.0.1, because it assumes that the
hosts file on Windows hasnt been configured.
4. My example has one connection created, but let us creates a new connection.
5. From the MySQL Workbench Home window, click the icon near the MySQL
Connections label. This opens the Setup New Connection wizard.
6. Click in the Connection Name text field and type CS31A.
7. That prompts you for the password to the root user in the following dialog
8. Click the Test Connection button to check the connection parameters.
Page 14 of 20
CS31A
9. Our new CS31A MySQL connection is now listed on the Home window.
10. From the Home window, click the new MySQL connection to open the SQL editor for
this connection. The SQL editor is the default page, so now select the Server Status from
the left Navigator panel to display the connected MySQL server's current status.
11. After launching the SQL Development connection, youll see the following MySQL
Workbench dialog. Notice that you can click the home symbol to return to the main menu
at any time.
Page 15 of 20
CS31A
Page 16 of 20
CS31A
In the Workbench,
you select a database
by clicking on it.
Page 17 of 20
CS31A
3. Type the new schema (database) name studentdb(lowercase names for schemas are enforced)
in the Name textbox and then click the Apply button.
4. An Apply SQL Script to Database dialog box is displayed so that the user can review the SQL
command before it is executed. Click the Apply button, then the Finish button.
5. The studentdb (the renamed new_schema) dialog box is displayed again. Click the X (Close)
button in the tab.
Page 18 of 20
CS31A
6. The studentdb schema object now appears in the Object Browser. You may need to click
Refresh Schemas(
3.4 What is a MySQL default schema? How do you specify the default schema?
Setting the Default Schema:
1. Click the studentdb schema object in the object browser to select it.
2. Right-click the studentdb schema object to display the shortcut menu:
3. In the shortcut menu, click the Set as Default Schema command.
4. The studentdb schema is set as the active schema (default schema), and the studentdb schema
object is displayed in bold text in the Object Browser to indicate that it is the active schema.
where <user> is the name of the new user and <password> is its password. To create a user
with an empty password, you can simply type CREATE USER <user>; skipping the
IDENTIFIED BY part. All user data is stored in the user table in the mysql database.
The command to create a database is CREATE DATABASE followed by the database name.
You use a semicolon to tell the dbms to execute the command.
Example : This is the command to create a user named student with a password of studentpass.
Note the use of quotes in the command.
You can create a student user and studentdb database using this syntax as the root user:
mysql> CREATE USER 'student'@'localhost' IDENTIFIED BY 'studentpass';
After creating the user, you should create a studentdb database. Heres the command syntax:
mysql > CREATE DATABASE studentdb;
This GRANT command gives all permissions on the studentdb to the student user:
Page 19 of 20
CS31A
Page 20 of 20