Java

Java is a set of computer software and specifications developed by Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers.

Spring Logo

Spring Framework

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

Hibernate Logo

Hibernate Framework

Hibernate ORM is an object-relational mapping framework for the Java language. It provides a framework for mapping an object-oriented domain model to a relational database.

Sunday, September 15, 2013

Installing MySQL on Windows

Installing MySQL on Windows

---------------------------------------------------

You can download the MySQL database from the MySQL website http://www.mysql.com by clicking on the downloads tab. Scroll down to the MySQL database server & standard clients section and select the latest production release of MySQL, 5.1.35 at the time of writing.

Installation of MySQL Server
 

Unzip the setup file and execute the downloaded MSI file. Follow the instructions below exactly when installing MySQL Server:
 
Click on the "setup" 

Perform a typical installation

Check box to configure MySQL Server 
If you checked the Configure the MySQL Server now check box on the final dialog of the MySQL 

Server installation, then the MySQL Server Instance Configuration Wizard will automatically start. 

Follow the instructions below carefully to configure your MySQL Server to run correctly with
EventSentry.

Select Detailed Configuration

I was installing it on my local machine where other applications & tools are running I decided to opt "developer machine" but it is recommended that you use a Dedicated MySQL Server Machine for your MySQL database, if this is not an option then select "Server Machine".

If you selected Dedicated MySQL Server Machine and your MySQL service does not start after the wizard completes, then try to re-run the wizard (or re-install) MySQL, but this time select the Server Machine option.

I have checked "Multifunctional databases" as I wanted MyISAM as default storage engine but if you want you can select "Transactional Database Only", this will make sure that InnoDB is the main storage engine. If you have checked 3rd option then only myISAM engine would be available.
Select the drive where the database files will be stored.
Select the drive on the fastest drive(s) on your server
.

It is recommended that you leave the default port 3306 in place, however 

EventSentry will also work with non-standard ports if necessary.



It is highly recommended that you run the MySQL Server as a Windows
service(you can disable this if you want to start it manually whenever required) and include the binary directory in the search path. 

Specify a secure root password, you may want to check the box Enable root access
from remote machines if you plan on administering your MySQL server from your workstation or other servers.
If you are getting an error message after clicking the Next button, then please enable port 3306
in the Windows XP Firewall Settings

Done!!!

But if you are installing MySQL on a Windows XP workstation, or any other computer that has a firewall enabled, and the wizard fails with an error message similar to the one shown below (Can't connect to MySQL server on 'localhost'), then you will have to exclude the MySQL daemon from your firewall configuration.

On Windows XP, you can exclude MySQL from the firewall by following the steps below: 
1. Navigate to Start -> Settings -> Control Panel -> Windows Firewall  

2. In the resulting dialog, enter the information as shown in the screenshot

After clicking OK twice, return to the MySQL error message and select Retry. MySQL should now be able to create the instance correctly.

How to Install MySQL on Fedora 17/18

Installing MySQL on Fedora 17/18

The following are the steps to install a MySQL in Fedora
  
Step1: Open terminal and change to root user

[ranga@ranga ~]$ su
Password:
[root@ranga ranga]# 

Step2: Install Remi repository by using following command

[root@ranga ranga]# rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm
-------------------------------------------------------------------
[root@ranga ranga]#

Step3: List out the all available versions

[root@ranga ranga]# yum --enablerepo=remi list mysql mysql-server
-------------------------------------------------------------------
Installed Packages
-------------------------------------------------------------------
mysql.x86_64                                                           5.5.33-1.fc17.remi                                                     remi   
mysql-server.x86_64                                                    5.5.33-1.fc17.remi                                                     remi   
[root@ranga ranga]# 

Here available version is 5.5.33

Step4: Install or update available mysql version

[root@ranga ranga]# yum --enablerepo=remi install mysql mysql-server
--------------------------------------------------------
Installed:
mysql-server.x86_64 0:5.5.33-1.fc17.remi                                                                                                           
--------------------------------------------------------
Updated:
mysql.x86_64 0:5.5.33-1.fc17.remi                                                                                                                  

Dependency Updated:
mysql-devel.x86_64 0:5.5.33-1.fc17.remi                                    mysql-libs.x86_64 0:5.5.33-1.fc17.remi                                  

Complete!

Step5: Start the MySQL server and autostart MySQL on boot

[root@ranga ranga]# systemctl start mysqld.service
[root@ranga ranga]# systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
Step6: MySQL Secure Installation
  1. Set (Change) root password(Mandatory)
  2. Remove anonymous users(Optional)
  3. Disallow root login remotely(Optional)
  4. Remove test database and access to it(Optional)
  5. Reload privilege tables(Optional)
 [root@ranga ranga]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y  
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Step7: Connect to MySQL database

[root@ranga ranga]# mysql -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.33 MySQL Community Server (GPL) by Remi

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

List out the all databases:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
mysql> 

Creating the Database

mysql> CREATE DATABASE ranga;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| ranga              |
| test               |
+--------------------+
5 rows in set (0.00 sec)
mysql> 

Creating the User and Droping the User

mysql> CREATE USER 'ranga' IDENTIFIED BY 'ranga';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON ranga.* TO 'ranga';
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> drop user 'ranga';
Query OK, 0 rows affected (0.00 sec)

List out the all users, hosts, and passwords

mysql> select user, host, password from mysql.user;
+-------+-----------+-------------------------------------------+
| user  | host      | password                                  |
+-------+-----------+-------------------------------------------+
| root  | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | 127.0.0.1 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
|       | localhost |                                           |
|       | ranga     |                                           |
| ranga | %         | *446F5A1568CCBD4237563DD8AF67580D8CF5AAA9 |
+-------+-----------+-------------------------------------------+
7 rows in set (0.00 sec)

Set the User password
mysql> set password for root@'127.0.0.1'= password('password');
Query OK, 0 rows affected (0.00 sec)

Delete the User by username
mysql> delete from mysql.user where user='ranga';
Query OK, 1 row affected (0.00 sec)

mysql> select user, host, password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
|      | localhost |                                           |
|      | ranga     |                                           |
+------+-----------+-------------------------------------------+
6 rows in set (0.00 sec)

Deleting the anonymous users
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)

mysql> select user, host, password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> 

Quit from MySQL
mysql> exit
Bye
Changing MySQL root user password using MySQL sql command

1) Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
3) Change password for user 'ranga'
mysql> update user set password=PASSWORD("reddy") where User='ranga';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

4) Finally, reload the privileges:
mysql> flush privileges;
mysql> quit
MySQL Root Password Recovery
Step # 1: Stop the MySQL server process.
[root@ranga ranga]# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
[root@ranga ranga]# mysqld_safe --skip-grant-tables &
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server as the root user.
[root@ranga ranga]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Step # 4: Setup new mysql root account password i.e. reset mysql password.
mysql> use mysql;

mysql> update user set password=PASSWORD("root") where User='root';

mysql> flush privileges;

mysql> quit

Step # 5: Stop the Server.
[root@ranga ranga]# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

Done mysqld_safe --skip-grant-tables
Step # 6: Start the Server and test it
[root@ranga ranga]# /etc/init.d/mysql start[root@ranga ranga]# mysql -u root -p

UnInstall the MySQL:
Step1: 
[root@ranga ~]# rpm -qa | grep mysqlmysql-server-5.5.33-1.fc17.remi.x86_64
mysql-libs-5.5.33-1.fc17.remi.x86_64
mysql-devel-5.5.33-1.fc17.remi.x86_64
mysql-5.5.33-1.fc17.remi.x86_64
Step2:  Remove the all packages that come out of the query above.
Note: You can tell RPM to ignore dependencies and just rip stuff out with the --nodeps flag. 
[root@ranga ~]# rpm -e mysql-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -qa | grep mysql
mysql-server-5.5.33-1.fc17.remi.x86_64
mysql-libs-5.5.33-1.fc17.remi.x86_64
mysql-devel-5.5.33-1.fc17.remi.x86_64
[root@ranga ~]# rpm -e mysql-server-5.5.33-1.fc17.remi.x86_64 --nodeps
warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[root@ranga ~]# rpm -e mysql-libs-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -e mysql-devel-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -qa | grep mysql
[root@ranga ~]#
In your system MySQL is successfully Uninstalled........
Another Trick to un install is
rpm -qa|grep <thing you want to uninstall> | xargs rpm -e
rpm -qa|grep mysql | xargs rpm -e
Simplest way of un install is System tools --> Add/Remove Application then looks for SQL and check MySQL to remove from the system.
Thanks for Reading this article.................