Difference between revisions of "My db-class.org notes"

From Got Opinion Wiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Useful links ==
== Class setup ==


[http://dev.mysql.com/doc/refman/5.6/en/index.html MySQL Reference Manual]
[[Software setup for db-class]]


[http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/ Install MySQL on Fedora]
== XML ==


== Installing required software on Fedora Core 15 ==
=== Useful resources ===


=== xmllint ===
W3Schools online introductions


My Fedora Core 15 had xmllint installed. To confirm you have the software installed:
[http://www.w3schools.com/xml/xml_whatis.asp Introduction to XML]
<pre>[ptay@robot logs]$ xmllint --version
xmllint: using libxml version 20707
  compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib
[ptay@robot logs]$</pre>


=== Kernow ===
[http://www.w3schools.com/dtd/dtd_intro.asp Introduction to DTD]


'''Download Kernow'''
[http://www.w3schools.com/Schema/schema_intro.asp Introduction to XML Schema]
<pre>[ptay@robot Kernow]$ wget http://downloads.sourceforge.net/project/kernowforsaxon/Kernow/Kernow%201.7.2/Kernow%201.7.2.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fkernowforsaxon%2F&ts=1318016634&use_mirror=iweb</pre>


'''Unzip Kernow file'''
[http://www.zvon.org Zvon.org] online course
<pre>[ptay@robot Downloads]$ unzip "Kernow 1.7.2.zip"
Archive:  Kernow 1.7.2.zip
  creating: Kernow 1.7.2/
  creating: Kernow 1.7.2/ant/
  inflating: Kernow 1.7.2/ant/kernow_sample_buildfile.xml 
  creating: Kernow 1.7.2/cache/
  inflating: Kernow 1.7.2/cache/catalog.xml 
  inflating: Kernow 1.7.2/cache/readme.txt 
  inflating: Kernow 1.7.2/cache/xhtml-lat1.ent 
  inflating: Kernow 1.7.2/cache/xhtml-special.ent 
  inflating: Kernow 1.7.2/cache/xhtml-symbol.ent 
  inflating: Kernow 1.7.2/cache/xhtml1-frameset.dtd 
  inflating: Kernow 1.7.2/cache/xhtml1-strict.dtd 
  inflating: Kernow 1.7.2/cache/xhtml1-transitional.dtd 
  creating: Kernow 1.7.2/extensions/
  inflating: Kernow 1.7.2/extensions/readme.txt 
  inflating: Kernow 1.7.2/Kernow.bat 
  inflating: Kernow 1.7.2/Kernow.exe 
  inflating: Kernow 1.7.2/kernow.jar 
  inflating: Kernow 1.7.2/Kernow.sh 
  creating: Kernow 1.7.2/lib/
  inflating: Kernow 1.7.2/lib/ant-launcher.jar 
  inflating: Kernow 1.7.2/lib/ant.jar 
  inflating: Kernow 1.7.2/lib/autocomplete.jar 
  inflating: Kernow 1.7.2/lib/AutoComplete.License.txt 
  inflating: Kernow 1.7.2/lib/cupv10k-runtime.jar 
  inflating: Kernow 1.7.2/lib/icu4j.jar 
  inflating: Kernow 1.7.2/lib/org.eclipse.wst.xml.xpath2.processor_1.1.0.jar 
  inflating: Kernow 1.7.2/lib/resolver.jar 
  inflating: Kernow 1.7.2/lib/rsyntaxtextarea.jar 
  inflating: Kernow 1.7.2/lib/saxon9he.jar 
  inflating: Kernow 1.7.2/lib/serializer.jar 
extracting: Kernow 1.7.2/lib/splash.gif 
  inflating: Kernow 1.7.2/lib/swing-layout-1.0.4.jar 
  inflating: Kernow 1.7.2/lib/xercesImpl.jar 
  inflating: Kernow 1.7.2/lib/xercesSamples.jar 
  inflating: Kernow 1.7.2/lib/xml-apis.jar 
  inflating: Kernow 1.7.2/readme.txt</pre>


Optional, remove .zip file by using <code>rm -f "Kernow 1.7.2.zip"</code> command.
[http://www.zvon.org/comp/r/tut-XML.html XML Tutorial]


Launch Kernow
[http://www.zvon.org/comp/r/tut-DTD.html DTD Tutorial]


Navigate to directory where Kernow is located (or create symbolic link and use symbolic link). This command will launch a Kernow java window.
W3C XML & XML Schema specifications
<pre>[ptay@robot Downloads]$ cd Kernow1.7.2/
[ptay@robot Kernow1.7.2]$ ls
ant    extensions  Kernow.exe  Kernow.sh  readme.txt
cache  Kernow.bat  kernow.jar  lib
[ptay@robot Kernow1.7.2]$ java -jar kernow.jar &
[1] 3370
[ptay@robot Kernow1.7.2]$</pre>


=== MySQL ===
[http://www.w3.org/TR/xml/ XML]


Ubuntu commands:
[http://www.w3.org/TR/xmlschema-0/ XML Schemas]
<pre>$ sudo apt-get install mysql-server mysql-common mysql-client</pre>


Fedora Core 15 commands:
== Relational Algebra ==
<pre>[ptay@robot logs]$ sudo yum groupinstall "MySQL Database"
[sudo] password for ptay:
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Group Process
updates/group_gz                                        | 420 kB    00:00   
Resolving Dependencies
--> Running transaction check
---> Package MySQL-python.x86_64 0:1.2.3-1.fc14 set to be installed
---> Package libdbi-dbd-mysql.x86_64 0:0.8.3-6.fc14 set to be installed
--> Processing Dependency: libdbi-drivers = 0.8.3-6.fc14 for package: libdbi-dbd-mysql-0.8.3-6.fc14.x86_64
--> Processing Dependency: libdbi.so.0()(64bit) for package: libdbi-dbd-mysql-0.8.3-6.fc14.x86_64
---> Package mysql.x86_64 0:5.1.58-1.fc14 set to be installed
---> Package mysql-connector-odbc.x86_64 0:5.1.5r1144-7.fc13 set to be installed
---> Package mysql-server.x86_64 0:5.1.58-1.fc14 set to be installed
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.58-1.fc14.x86_64
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.58-1.fc14.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc14 set to be installed
---> Package unixODBC.x86_64 0:2.2.14-12.fc14 set to be installed
--> Running transaction check
---> Package libdbi.x86_64 0:0.8.3-4.fc14 set to be installed
---> Package libdbi-drivers.x86_64 0:0.8.3-6.fc14 set to be installed
---> Package perl-DBI.x86_64 0:1.613-1.fc14 set to be installed
--> Finished Dependency Resolution


Dependencies Resolved
[http://en.wikipedia.org/wiki/Relational_algebra Relational algebra] on Wikipedia


================================================================================
A commercially failed relational algebra database called [http://en.wikipedia.org/wiki/Business_System_12 Business System 12] on Wikipedia
Package                  Arch      Version                  Repository  Size
================================================================================
Installing:
MySQL-python            x86_64    1.2.3-1.fc14            updates      79 k
libdbi-dbd-mysql        x86_64    0.8.3-6.fc14            fedora      14 k
mysql                    x86_64    5.1.58-1.fc14            updates    883 k
mysql-connector-odbc    x86_64    5.1.5r1144-7.fc13        fedora      114 k
mysql-server            x86_64    5.1.58-1.fc14            updates    8.1 M
perl-DBD-MySQL          x86_64    4.017-1.fc14            fedora      136 k
unixODBC                x86_64    2.2.14-12.fc14          fedora      383 k
Installing for dependencies:
libdbi                  x86_64    0.8.3-4.fc14            fedora      39 k
libdbi-drivers          x86_64    0.8.3-6.fc14            fedora      372 k
perl-DBI                x86_64    1.613-1.fc14            fedora      776 k


Transaction Summary
[http://en.wikipedia.org/wiki/Rel_%28DBMS%29 Rel] an open source relational database management system primarily used in teaching.
================================================================================
Install      10 Package(s)


Total download size: 11 M
[http://db.grussell.org/section010.html Relational Algebra] portion of a [http://db.grussell.org/index.html database eLearning site].
Installed size: 30 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 11 M
(1/10): MySQL-python-1.2.3-1.fc14.x86_64.rpm            |  79 kB    00:00   
(2/10): libdbi-0.8.3-4.fc14.x86_64.rpm                  |  39 kB    00:00   
(3/10): libdbi-dbd-mysql-0.8.3-6.fc14.x86_64.rpm        |  14 kB    00:00   
(4/10): libdbi-drivers-0.8.3-6.fc14.x86_64.rpm          | 372 kB    00:00   
(5/10): mysql-5.1.58-1.fc14.x86_64.rpm                  | 883 kB    00:00   
(6/10): mysql-connector-odbc-5.1.5r1144-7.fc13.x86_64.rp | 114 kB    00:00   
(7/10): mysql-server-5.1.58-1.fc14.x86_64.rpm            | 8.1 MB    00:02   
(8/10): perl-DBD-MySQL-4.017-1.fc14.x86_64.rpm          | 136 kB    00:00   
(9/10): perl-DBI-1.613-1.fc14.x86_64.rpm                | 776 kB    00:00   
(10/10): unixODBC-2.2.14-12.fc14.x86_64.rpm              | 383 kB    00:00   
--------------------------------------------------------------------------------
Total                                          1.0 MB/s |  11 MB    00:10   
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing    : libdbi-0.8.3-4.fc14.x86_64                              1/10
  Installing    : mysql-5.1.58-1.fc14.x86_64                              2/10
  Installing    : perl-DBI-1.613-1.fc14.x86_64                            3/10
  Installing    : unixODBC-2.2.14-12.fc14.x86_64                          4/10
  Installing    : mysql-connector-odbc-5.1.5r1144-7.fc13.x86_64          5/10
  Installing    : MySQL-python-1.2.3-1.fc14.x86_64                        6/10
  Installing    : perl-DBD-MySQL-4.017-1.fc14.x86_64                      7/10
  Installing    : libdbi-drivers-0.8.3-6.fc14.x86_64                      8/10
  Installing    : libdbi-dbd-mysql-0.8.3-6.fc14.x86_64                    9/10
  Installing    : mysql-server-5.1.58-1.fc14.x86_64                      10/10


Installed:
== Other Useful links ==
  MySQL-python.x86_64 0:1.2.3-1.fc14                                           
  libdbi-dbd-mysql.x86_64 0:0.8.3-6.fc14                                       
  mysql.x86_64 0:5.1.58-1.fc14                                                 
  mysql-connector-odbc.x86_64 0:5.1.5r1144-7.fc13                             
  mysql-server.x86_64 0:5.1.58-1.fc14                                         
  perl-DBD-MySQL.x86_64 0:4.017-1.fc14                                         
  unixODBC.x86_64 0:2.2.14-12.fc14                                             


Dependency Installed:
[http://dev.mysql.com/doc/refman/5.6/en/index.html MySQL Reference Manual]
  libdbi.x86_64 0:0.8.3-4.fc14        libdbi-drivers.x86_64 0:0.8.3-6.fc14   
  perl-DBI.x86_64 0:1.613-1.fc14   


Complete!</pre>
[http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/ Install MySQL on Fedora]
 
'''Enable MySQL at specific run levels (I did 3 & 5)'''
<pre>[ptay@robot logs]$ sudo chkconfig --level 35 mysqld on
[ptay@robot logs]$ chkconfig --list | grep -i mysqld
mysqld          0:off  1:off  2:off  3:on    4:off  5:on    6:off</pre>
 
'''Start MySQL daemon (mysqld)'''
As root
<pre>
[root@robot ~]# service mysqld restart
Stopping mysqld:  [ OK  ]
Initializing MySQL database:  Installing MySQL system tables...
OK
 
//////////////omitting text/////////////////////
 
Starting mysqld: [  OK  ]</pre>
 
'''Run MySQL secure installation script'''
As root
<pre>[root@robot ~]# /usr/bin/mysql_secure_installation
 
//////////////omitting text/////////////////////
 
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Cleaning up...
 
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
 
Thanks for using MySQL!</pre>
 
'''Test MySQL'''
As any user
<pre>[root@robot ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.58 Source distribution
 
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| mysql             |
+--------------------+
2 rows in set (0.00 sec)
 
mysql> create database test;
Query OK, 1 row affected (0.01 sec)
mysql> use test
Database changed
mysql> use test;
Database changed
mysql> drop table if exists T;
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
mysql> create table T (A text, B text);
insert into T values ('Hello,', 'world!');
select * from T;Query OK, 0 rows affected (0.06 sec)
 
mysql> insert into T values ('Hello,', 'world!');
Query OK, 1 row affected (0.00 sec)
 
mysql> select * from T;
+--------+--------+
| A      | B      |
+--------+--------+
| Hello, | world! |
+--------+--------+
1 row in set (0.00 sec)
 
mysql> \q
Bye</pre>


<center>[[Education|To Education]]</center>
<center>[[Education|To Education]]</center>

Latest revision as of 08:40, 23 October 2011

Class setup

Software setup for db-class

XML

Useful resources

W3Schools online introductions

Introduction to XML

Introduction to DTD

Introduction to XML Schema

Zvon.org online course

XML Tutorial

DTD Tutorial

W3C XML & XML Schema specifications

XML

XML Schemas

Relational Algebra

Relational algebra on Wikipedia

A commercially failed relational algebra database called Business System 12 on Wikipedia

Rel an open source relational database management system primarily used in teaching.

Relational Algebra portion of a database eLearning site.

Other Useful links

MySQL Reference Manual

Install MySQL on Fedora

To Education