Tuesday, November 15, 2011

Step by step guide to install MySQL



Step 1. Download MySQL Installer (mysql-advanced-5.5.8-win32.msi) file from the website of MySQL 




Go to URL http://www.mysql.com/downloads/mysql/

MySQL Installer provides an easy to use, wizard-based installation experience for all your MySQL software needs. Included in the product are the latest versions of:

MySQL Server
All of our support connectors
Workbench and sample models
Sample databases
Documentation


Step 2. After downloading  the installer file e.g mysql-advanced-5.5.8-win32.msi

Open the file. It will start installer wizard. Please go throw the screen shot below.

Mostly you do not have to change the default setting, just continue with the wizard.








At this point, Note the port number. Default port number is 3306, If you wish you could change it else let go by default port number.




At this point, put password for security and note that password for login latter.


You are almost done...


Step 3. Now that MySQL is installed, You can confirm it by login to it.

Try through  Start - All programms - My SQL.

If you cannot start the server through  Start - All programms - My SQL

The best way to login without any problem is.
Go to command prompt. The folder where MySQL is installed.
Probably Program Files\MySQL\MySQL Server 5.5\bin
Use Command : mysql -u root -p
Put the password and you are in the database.



DB2 : Get all column name of a particular Table

Query :


SELECT TABNAME,COLNAME from SYSCAT.COLUMNS where TABNAME='table_name'


You can use above mentioned query for getting all column name of a particular table in DB2.

Could not determine current working directory

If you get below mentioned error



Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
        at java.lang.System.initProperties(Native Method)
        at java.lang.System.initializeSystemClass(System.java:1070)


There could be two possible reasons.

1. You have not set the proper classpath, If this the case then make sure you set JAVA_HOME path in class path.

2.  You do not have the permission to start the java process in that directory, Simply ask your UNIX / LINUX administrator to grant the access.

Also you can try running the java process from your home directory.


Connection authorization failure occurred. Reason: User ID or Password invalid.

If you get below mentioned error


Exception in thread "main" com.ibm.db2.jcc.b.bo: [jcc][t4][2013][11249][3.53.95]
 Connection authorization failure occurred.  Reason: User ID or Password invalid. ERRORCODE=-4214, SQLSTATE=28000
        at com.ibm.db2.jcc.b.bd.a(bd.java:674)
        at com.ibm.db2.jcc.b.bd.a(bd.java:60)
        at com.ibm.db2.jcc.b.bd.a(bd.java:120)
        at com.ibm.db2.jcc.t4.b.o(b.java:2018)
        at com.ibm.db2.jcc.t4.b.c(b.java:1646)
        at com.ibm.db2.jcc.t4.bb.r(bb.java:793)
        at com.ibm.db2.jcc.t4.bb.k(bb.java:349)
        at com.ibm.db2.jcc.t4.bb.c(bb.java:133)
        at com.ibm.db2.jcc.t4.b.Oc(b.java:1271)
        at com.ibm.db2.jcc.t4.b.b(b.java:1192)
        at com.ibm.db2.jcc.t4.b.B(b.java:5098)
        at com.ibm.db2.jcc.t4.b.c(b.java:750)
        at com.ibm.db2.jcc.t4.b.b(b.java:693)
        at com.ibm.db2.jcc.t4.b.a(b.java:376)
        at com.ibm.db2.jcc.t4.b.(b.java:312)
        at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
        at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:224)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)


As the error suggest, The login credentials are not matching. Please make sure that user name and password are correct.

Also check for correct URL. Make sure that all login credentials are correct.

Connection authorization failure occurred. Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000

If you get mentioned error



Exception in thread "main" com.ibm.db2.jcc.b.bo: [jcc][t4][201][11237][3.53.95]
Connection authorization failure occurred.  Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000
        at com.ibm.db2.jcc.b.bd.a(bd.java:674)
        at com.ibm.db2.jcc.b.bd.a(bd.java:60)
        at com.ibm.db2.jcc.b.bd.a(bd.java:120)
        at com.ibm.db2.jcc.t4.b.o(b.java:1981)
        at com.ibm.db2.jcc.t4.b.a(b.java:1554)
        at com.ibm.db2.jcc.t4.bb.b(bb.java:3405)
        at com.ibm.db2.jcc.t4.bb.a(bb.java:332)
        at com.ibm.db2.jcc.t4.bb.a(bb.java:112)
        at com.ibm.db2.jcc.t4.b.l(b.java:1247)
        at com.ibm.db2.jcc.t4.b.b(b.java:1120)
        at com.ibm.db2.jcc.t4.b.c(b.java:707)
        at com.ibm.db2.jcc.t4.b.b(b.java:693)
        at com.ibm.db2.jcc.t4.b.a(b.java:376)
        at com.ibm.db2.jcc.t4.b.(b.java:312)
        at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
        at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:224)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)


As the error suggest, You are not authorized to access the database. I am not sure on this, possibly this could be the one reason for the above error.


Try using different Driver,


I was using DB2 Universal Driver, when i got above error

Class.forName("com.ibm.db2.jcc.DB2Driver");
con=DriverManager.getConnection("jdbc:db2://hostname:port/Schema","username","password");

Jar file : db2jcc.jar


I switched to App JDBC Driver, and it solved the error.

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
con=DriverManager.getConnection("jdbc:db2:Test","uername","passowrd");

Jar file : db2java.jar


To download Jar files : Click here

If still you face the issue, contact your server administrator.