Pages

Tuesday, September 10, 2013

My Sql Data Base Installation

My Sql Is One of the Best used Data bases.In This article we will see how we can install My Sql on Linux

1.Download the latest stable relase of MySQL
Download mysql Packages from the mysql.com. Make sure to download MySQL Server, Client and “Headers and libraries” from the download page.Here are the Necessary Packages

MySQL-client-community-5.1.25-0.rhel5.i386.rpm
MySQL-server-community-5.1.25-0.rhel5.i386.rpm
MySQL-devel-community-5.1.25-0.rhel5.i386.rpm

2.Remove the existing default MySQL that came with the Linux Distribution
[local-host]# rpm -qa | grep -i mysql
mysql-5.0.22-2.1.0.1
mysqlclient10-3.23.58-4.RHEL4.1

[local-host]# rpm -e mysql --nodeps
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[local-host]# rpm -e mysqlclient10

3.Install the packages

Install the MySQL Server and Client packages as shown below.

[local-host]# rpm -ivh MySQL-server-community-5.1.25-0.rhel5.i386.rpm MySQL-client-community-5.1.25-0.rhel5.i386.rpm
Preparing...######################## [100%]
1:MySQL-client-community ############### [ 50%]
2:MySQL-server-community ############### [100%]

Install the “Header and Libraries” that are part of the MySQL-devel packages.

[local-host]# rpm -ivh MySQL-devel-community-5.1.25-0.rhel5.i386.rpm
Preparing...###################### [100%]
1:MySQL-devel-community ######################## [100%]

4. Verify the MySQL installation

You can check the MySQL installed version by performing mysql -V as shown below:

[local-host]# mysql -V
mysql Ver 14.14

Make sure that mysqld process is enabled in current run level, execute
chkconfig mysqld on

To check the status if it is on in the current run level, execute
chkconfig –list | grep mysqld

Now start the mysqld service, execute
service mysqld restart (if it shows failed at first time ,execute the same command for the second time)

Once the services are restarted and ready, start mysql using
mysql –u root –h localhost –p (no password here)
It will ask for password, just press enter.

5.Data Base Creation

create database lportal default character set utf8; (create lportal database with utf8 as default character set)

To check the available database,
show databases;

Now we need to use lportal database to create tables necessary , execute

mysql> use lportal;
Database changed

now lets create the tables necessary , execute
mysql> CREATE TABLE tutorials(
-> tutorial_id INT NOT NULL AUTO_INCREMENT,
-> tutorial_title VARCHAR(100) NOT NULL,
-> tutorial_author VARCHAR(40) NOT NULL,
-> submission_date DATE,
-> PRIMARY KEY ( tutorial_id )
-> );

Query OK, 0 rows affected (0.16 sec)

It will process for a few seconds and tables will be created.

Now check the tables using, show tables;

You can see a list of tables created in lportal database.

Open the SQL administrator from the mysql-gui tools and connect to localhost using port 3306 and username root with no password.

By this we completed the configuration of LifeRay related database in mysql.

More To Come , Happy learning :-)