Monday, August 27, 2012

MySQL - 3 : Working on the Installed MySQL

Login and check the Database created in the First Post on MySQL -1


  • Go to the MySQL Workbench and find the mysql.exe
  • Login to the MySQL using the below command in the command prompt



C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.42>mysql.exe -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, 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>

  • Now we can list the default Databases using the command,
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| world              |
+--------------------+
5 rows in set (0.00 sec)

  • To use a Database and list the tables in the Database use the below commands,
mysql> USE test;
Database changed

mysql> SHOW tables;
Empty set (0.00 sec)

mysql> USE world;
Database changed

mysql> SHOW tables;
+-----------------+
| Tables_in_world |
+-----------------+
| city            |
| country         |
| countrylanguage |
+-----------------+
3 rows in set (0.00 sec)

mysql> DESCRIBE city;
+-------------+----------+------+-----+---------+----------------+
| Field       | Type     | Null | Key | Default | Extra          |
+-------------+----------+------+-----+---------+----------------+
| ID          | int(11)  | NO   | PRI | NULL    | auto_increment |
| Name        | char(35) | NO   |     |         |                |
| CountryCode | char(3)  | NO   |     |         |                |
| District    | char(20) | NO   |     |         |                |
| Population  | int(11)  | NO   |     | 0       |                |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.03 sec)


  • Creating a Database ,table and changing the Storage engine of the created database.
mysql> create database sri;
Query OK, 1 row affected (0.01 sec)

mysql> USE sri;
Database changed
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sri                |
| test               |
| world              |
+--------------------+
6 rows in set (0.00 sec)

mysql> create table test (name varchar(20),age number);
ERROR 1064 (42000): You have an error in your SQL syntax; check
r)' at line 1
mysql> create table test (name varchar(20),age int);
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;
+---------------+
| Tables_in_sri |
+---------------+
| test          |
+---------------+
1 row in set (0.00 sec)

mysql>


mysql> describe test;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| name  | varchar(20) | YES  |     | NULL    |       |
| age   | int(11)     | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)

mysql> alter table test ENGINE = InnoDB;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

  • To View the available Plugins and engines,
mysql> show plugins;
+-----------------------+----------+--------------------+---------+---------+
| Name                  | Status   | Type               | Library | License |
+-----------------------+----------+--------------------+---------+---------+
| binlog                | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| mysql_native_password | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
| mysql_old_password    | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
| CSV                   | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| MEMORY                | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| MyISAM                | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| MRG_MYISAM            | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| ARCHIVE               | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| BLACKHOLE             | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| FEDERATED             | DISABLED | STORAGE ENGINE     | NULL    | GPL     |
| InnoDB                | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| INNODB_TRX            | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCKS          | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCK_WAITS     | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP            | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP_RESET      | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM         | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM_RESET   | ACTIVE   | INFORMATION SCHEMA | NULL    | GPL     |
| PERFORMANCE_SCHEMA    | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| partition             | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
+-----------------------+----------+--------------------+---------+---------+
20 rows in set (0.04 sec)




In the next post will see on the structures ...

MySQL - 1 : MySQL Installation


Installing the MySQL in Windows,
Download the MySQL  Software and install it as below,
If you don't have the required softwares for MySQL to run then it will pop up the dialog box and will request you to install.











I have created one more user apart from root and given the role "DB Admin"










Completed the installation of the MySQL in Windows.









Thursday, August 23, 2012

MySQL - 2 : MYSQL Tools Installation


Installing MySQL Tools  in Windows

Download  MySQL  Tools from :  http://dev.mysql.com/downloads/gui-tools/5.0.html

For Windows :


Click on the Downloaded .msi file and follow the screenshot ,


 Accept the Agreement and click on Next 








Wednesday, August 22, 2012

ODI : Reset SUPERVISOR Password

After the Creation of the Master Repository and import of the repository zip from the different ODI Repositroy, the password of the SUPERVISOR gets set to the one of the ZIP file.
So it will pop up the below error while trying to login after the import :


oracle.odi.core.security.BadCredentialsException: Incorrect ODI username or password
at oracle.odi.core.security.SecurityManager.doODIInternalAuthentication(SecurityManager.java:392)
at oracle.odi.core.security.SecurityManager.createAuthentication(SecurityManager.java:260)
at oracle.odi.ui.docking.panes.OdiCnxFactory$1.run(OdiCnxFactory.java:214)
at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
at java.lang.Thread.run(Thread.java:662)

To reset the password of the SUPERVISOR follow the below steps,

  • Login to the MREP schema in the Database.
  • Select the SNP_USER table to verify the username.
  • Using the encode.sh ,create a encrypted password.
  • Update the SNP_USER Table with the Password generated using the encode.sh for the SUPERVISOR user.
  • Now, login to the ODI GUI .

Monday, August 6, 2012

snippets - SQL Developer

A nice feature of SQL developer, SNIPPETS.





You can bring up the Snippet toolbar by clicking on
View --> Snippets













It opens the snippet toolbar at the right pane with the default snippets
The Default snippets has the queries, the functions and a lot of good options. 
Also we can add a snippet of our wish and run it whenever we want.
Its really a good tool to be used in your Sql- developer ... Try ii