Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Showing posts with label Linux-DB-Servers. Show all posts
Showing posts with label Linux-DB-Servers. Show all posts

Sunday 18 December 2016

How To Install Oracle 12c on RHEL/CentOS 6x

How To Install Oracle 12c on RHEL/CentOS 6x


Step: 1. Stop Iptables & Disable Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 2. Restart the Server :

# init 6

Step: 3. Bind the Hosts File :

# vi /etc/hosts

192.168.100.221 db01.domain.com    db01

-- Save & Quit (:wq)

Step: 4. Set Hostname :

# vi /etc/sysconfig/network

HOSTNAME=db01.domain.com

-- Save & Quit (:wq)

# hostname db01.domain.com

Step: 5. Update the System :

# yum -y update

Step: 6. Add the Following lines in the "/etc/sysctl.conf" file :

# vi /etc/sysctl.conf

# Oracle Important Parameter :
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

-- Save & Quit (:wq)

-- To Load the Configuration :

# sysctl -p

Step: 7. Add the Following lines to the "/etc/security/limits.conf" file :

# vi /etc/security/limits.conf

# Oracle Important Parameter :
oracle   soft   nofile     1024
oracle   hard   nofile    65536
oracle   soft   nproc     2047
oracle   hard   nproc   16384
oracle   soft   stack       10240
oracle   hard   stack      32768

-- Save & Quit (:wq)

Step: 8. Install the Following Required Packages for Oracle 12c :

# yum -y install binutils compat-libcap1 compat-libstdc++* gcc* glibc* ksh libgcc* libstdc++* libaio* libXext* libX11* libXau* libxcb* libXi* make sysstat unixODBC*

Or Install the Package One by One :

# yum -y install binutils
# yum -y install compat-libcap1
# yum -y install compat-libstdc++-33
# yum -y install compat-libstdc++-33.i686
# yum -y install gcc
# yum -y install gcc-c++
# yum -y install glibc
# yum -y install glibc.i686
# yum -y install glibc-devel
# yum -y install glibc-devel.i686
# yum -y install ksh
# yum -y install libgcc
# yum -y install libgcc.i686
# yum -y install libstdc++
# yum -y install libstdc++.i686
# yum -y install libstdc++-devel
# yum -y install libstdc++-devel.i686
# yum -y install libaio
# yum -y install libaio.i686
# yum -y install libaio-devel
# yum -y install libaio-devel.i686
# yum -y install libXext
# yum -y install libXext.i686
# yum -y install libXtst
# yum -y install libXtst.i686
# yum -y install libX11
# yum -y install libX11.i686
# yum -y install libXau
# yum -y install libXau.i686
# yum -y install libxcb
# yum -y install libxcb.i686
# yum -y install libXi
# yum -y install libXi.i686
# yum -y install make
# yum -y install sysstat
# yum -y install unixODBC
# yum -y install unixODBC-devel

Step: 9. Create the new groups & users for Oracle :

# groupadd dba
# useradd -g dba oracle

Step: 10. Edit the "/etc/security/limits.d/90-nproc.conf" file :

# vi /etc/security/limits.d/90-nproc.conf

# Change this :
*          soft    nproc    1024

# To this :
*          soft    nproc    16384

-- Save & Quit (:wq)

Step: 11. Create the Directories in which the Oracle Software will be Installed :

# mkdir -p /u01/app/oracle/product/12.1.0/db_1
# chown -Rf oracle:dba /u01
# chmod -Rf 775 /u01

Step: 12. Configure the .bash_profile for Oracle :

# su - oracle
$ vi .bash_profile

-- Add the Following Lines at the End of the file :

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=db01.domain.com
export ORACLE_UNQNAME=oradb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=oradb

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

-- Save & Quit (:wq)

$ . .bash_profile
$ exit

-- Copy the Software of Oracle 12c (in zip) in to '/u01' location using Winscp.

# cd /u01
# unzip linuxamd64_12102_database_1of2.zip
# unzip linuxamd64_12102_database_2of2.zip
# chmod -Rf 777 database
# chown -Rf oracle:dba database
# ll

[OUTPUT]
drwxrwxrwx 7 oracle dba        4096 Jul  7 20:09 database

Open Xmanager & do the following Step :

Click New -> Give Session Name -> OK -> Host: (192.168.100.221) -> Protocaol: (SSH) -> User Name: (root) -> Click on Password Setup -> Give Password -> Check on Save Password -> OK -> Command: (xterm -ls -display $DISPLAY) -> Click on Save -> Run.

# su - oracle

Start the Oracle Universal Installer (OUI) by issuing the following command in the Database Directory.
$ sh /u01/database/runInstaller

-- Email (leave blank)
-- Uncheck I Wish to receive security updates vi My Oracle Support.
-- Click "Next"
-- Yes
-- Choose Install database Software Only.
-- Click "Next"
-- Choose Single Instance Database Installtion
-- Click "Next"
-- Add Language (English)
-- Click "Next"
-- Choose Enterprise Edition
-- Click "Next"
-- Oracle Base: /u01/app/oracle
-- Software Location: /u01/app/oracle/product/12.1.0/db_1
-- Click "Next"
-- Inventory Ditectory: /u01/app/oraInventory
-- Ora Inventory Group Name: dba
-- Click "Next"
-- Click "Next"
-- Check on "Ignore All"
-- Click "Next"
-- Yes
-- Click On "Install"

Note: after installation the s/w run the two scripts genrated by system on root user.

# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/oracle/product/12.1.0/db_1/root.sh

OK -> Close.

Create Database using dbca with the help of xmanager.

# su - oracle
$ dbca

-- Choose "Create Database"
-- Click "Next"
-- Advanced Mode
-- Click "Next"
-- Choose General Purpose or Transaction Processing
-- Click "Next"
-- Global Database Name: oradb
-- Click "Next"
-- Click "Next"
-- Choose Use the Same Administrative Password for All Account
-- Give Password
-- Click "Next"
-- Click "Next"
-- Click "Next"
-- Check "Sample Schemas"
-- Click "Next"
-- Memory Size: (Upto 75-80%)
-- Click "Next"
-- Click "Next"
-- Finally Click "Finish".
-- Close.

Note: If Facing any Memory_Target related error then do the following :

-- Increase Temp Size :

# df -h
# mount -o remount,size=1G /dev/shm
# df -h
# vi /etc/fstab

tmpfs  /dev/shm  tmpfs  defaults,size=1G  0 0

-- Save & Quit (:wq)

# mount -a

After this do the Above Step to Create a Database.

# su - oracle

To View the Database :

# cat /etc/oratab

oradb:/u01/app/oracle/product/12.1.0/db_1:N

$ sqlplus / as sysdba

To Start the Database :

SQL> startup

ORACLE instance started.

Total System Global Area  413372416 bytes
Fixed Size                                     2289016 bytes
Variable Size                              335544968 bytes
Database Buffers                    71303168 bytes
Redo Buffers                             4235264 bytes
Database mounted.
Database opened.
SQL>

To Check The Oracle Version :

SQL> select version from v$instance;

VERSION
------------
12.1.0.2.0

To Shutdown the Database :

SQL> shutdown immediate

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Saturday 1 October 2016

Install & Configure Apache CouchDB 1.6.1 on Ubuntu 14.04

Install & Configure Apache CouchDB 1.6.1 on Ubuntu 14.04


What is Apache CouchDB?

-- Apache CouchDB is an open source document-oriented database with NoSQL. NoSQL means, it doesn’t have any database schema, tables, rows, etc. CouceDB uses JSON to store data with documents, which you can access from a web browser via HTTP. CouchDB works smoothly with all latest modern web and mobile apps.

Step: 1. Install Build Tools & Required Dependencies :
 
# apt-get update
# apt-get -y upgrade
# apt-get -y install build-essential erlang-base-hipe erlang-dev erlang-manpages erlang-eunit \
   erlang-nox libicu-dev libmozjs185-dev libcurl4-openssl-dev wget

Step: 2. Installing CouchDB  :

# cd /tmp
# wget http://mirror.fibergrid.in/apache/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
# tar -xvf apache-couchdb-1.6.1.tar.gz
# rm -rf apache-couchdb-1.6.1.tar.gz
# cd apache-couchdb-1.6.1
# ./configure
# make && make install

Step: 3. Configuring CouchDB :

# adduser --disabled-login --disabled-password --no-create-home couchdb
# chown -Rf couchdb:couchdb /usr/local/var/lib/couchdb/
# chown -Rf couchdb:couchdb /usr/local/var/log/couchdb/
# chown -Rf couchdb:couchdb /usr/local/var/run/couchdb/
# ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb
# update-rc.d couchdb defaults

Step: 4. Give HTTP Access To CouchDB :

# vi /usr/local/etc/couchdb/local.ini

-- Uncomment & Modify Line No. 11 & 12 :

[httpd]
port = 5984
bind_address = 0.0.0.0

-- Save & Quit (:wq)

Step: 5. Start CouchDB Service :

# service couchdb start
# service couchdb status

Step: 6. Verifing CouchDB :

# curl http://localhost:5984

Or

Open Web Browser & Type: http://10.100.97.37:5984

Step: 7. Access Couchdb Web Interface For Manage the Database :

http://10.100.97.37:5984/_utils/

-- Create Admin User :

-- By Default there is no admin user, you need to create one by just clicking on the bottom right
     corner that says "Fix this". Once you click on that link you will prompted to enter admin user
     and password.

-- Give Username & Password.
-- Click on "Create" Button.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Sunday 14 August 2016

How To Reset MySQL Root Password in CentOS/RHEL & Ubuntu

How To Reset MySQL Root Password in  CentOS/RHEL & Ubuntu


For CentOS/RHEL User :

Step: 1. Stop MySQL Service :

# service mysqld stop

Step: 2. Start to MySQL Server without Password :

# mysqld_safe --skip-grant-tables &

Step: 3. Connect to MySQL Server using MySQL Client :

# mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("new_password") where User='root';
mysql> flush privileges;
mysql> quit

Step: 4. Stop the MySQL Server Again :

# service mysqld stop

Step: 5. Start MySQL Server Normally & Test it :

# service mysqld restart
# chkconfig mysqld on

# mysql -u root -p
Enter Password:

For Debian/Ubuntu User :

$ sudo dpkg-reconfigure mysql-server-5.5
--  Give New Password.


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Saturday 9 July 2016

How To Install & Use Of PostgreSQL on Ubuntu 14.04

Install & Use Of PostgreSQL on Ubuntu 14.04

Q. What is PostgreSQL ?

-- PostgreSQL, or Postgres, is a relational database management system that provides an implementation of the SQL querying language. It is a popular choice for many small and large projects and has the advantage of being standards-compliant and having many advanced features like reliable transactions and concurrency without read locks.

Step: 1. Install PostgreSQL :
   
# apt-get updat
# apt-get -y upgrade
# apt-get install postgresql postgresql-contrib
# vi /etc/postgresql/9.3/main/pg_hba.conf
   
Step: 2. Edit on line 90 & 92 to make sure the file has :

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

-- Save & Quit (:wq)
       
# sudo /etc/init.d/postgresql restart
   
Step: 3. Login to postgres :

# sudo -i -u postgres

Step: 4. Set a password for the "postgres" Database role using the Command :

postgres=# \password postgres

Step: 5. To Create a  User :

postgres=# CREATE USER koushik WITH password 'redhat';
CREATE ROLE

Step: 6. To Create a Database :

postgres=# CREATE DATABASE mydb WITH OWNER koushik;
CREATE DATABASE

Step: 7. List of the Database present on the Server :

postgres=# \l

Step: 8. To See all Databases :

postgres=# \l
                                  
PostgreSQL
Step: 9. To Select a Database :

postgres=# \connect mydb

Step: 10. To Create a Table :

postgres=# CREATE TABLE COMPANY(
   ID INT PRIMARY KEY     NOT NULL,
   NAME           TEXT    NOT NULL,
   AGE            INT     NOT NULL,
   ADDRESS        CHAR(50),
   SALARY         REAL
);

Step: 11. To view Created Tables :

postgres=# \d

PostgreSQL













Step: 12. Change the Owner of the Table :

postgres=# \connect mydb

mydb=# ALTER TABLE blocks OWNER to koushik;


From the psql Command line Interface :

mydb=# \dt

Step: 13. Drop Database :

postgres@ser4:~$ psql
postgres=# DROP DATABASE mydb;
                            
Step: 14. Restoring the dump Backup of SQL :
   
# sudo -i -u postgres
   
$ psql database_name < /data/backup.sql
   
From Linux/Debian Terminal without login to postgres :

Step: 15. To Create a Database with a User that have full rights on the Database, use the Following Command :

# sudo -u postgres createuser -D -A -P koushik

# sudo -u postgres createdb -O koushik mydb

Note: The first command line creates the user with no database creation rights (-D) with no add user rights -A) and will prompt you for entering a password (-P). The second command line create the database 'mydb with 'koushik' as owner.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Tuesday 14 June 2016

How To Reset A Forgotten MariaDB Root Password on CentOS 7

How To Reset A Forgotten MariaDB Root Password on CentOS 7

MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. It is notable for being led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.

Step: 1. Stop the Database Server :

# systemctl stop mariadb.service

On Ubuntu Users :

# service mariadb stop

Step: 2. Start MariaDB with Unrestricted Access :

# mysqld_safe --skip-grant-tables --skip-networking &

Press Enter.

Step: 3. Now the Database is Started, Logon to it without Passwords :

# mysql -u root

Step: 4. Change the MariaDB root Password :

mariadb> use mysql;
mariadb> update user set password=PASSWORD("new-password") where User='root';
mariadb> flush privileges;
mariadb> \q

Step: 5. Stop the Database :

# systemctl stop mariadb.service

Step: 6. Now Start the MariaDB Service :

# systemctl start mariadb.service

Step: 7. Logon as the root User with the New Password :

# mysql -u root -p

Enter Password:

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Saturday 7 May 2016

How To Install & Configure Percona XtraDB Cluster 5.6 on CentOS/RHEL 6x


How To Install Percona XtraDB Cluster 5.6 on CentOS/RHEL 6x


This Cluster will be assembled of Two (2) Servers/Nodes :

Node #1
Hostname: server1.centos.com
IP: 192.168.100.140

Node #2
Hostname: server2.centos.com
IP: 192.168.100.142

Prerequisites :
==========

1. All two Nodes have a CentOS 6.6 Installation.
2. Firewall has been set up to allow Connecting to Ports 3306, 4444, 4567 and 4568
3. SELinux is Disabled
4. MySQL should be Removed.

5. Configure Password-less Authentication (RSA/DSA) (Optional).

Installation :
=========
   
Step: 1. Make entry to the host file of each Server :

# vi /etc/hosts

192.168.100.140 server1.centos.com   server1
192.168.100.142 server2.centos.com   server2

-- Save & Quit (:wq)
   
Step: 2. Enable EPEL Repo and Percona Repo on your Server :

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
   
Step: 3. Install Dependency for Percona :

# yum install -y socat libaio* perl-DBD-MySQL  perl-Time-HiRes rsync wget
# wget --no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo -O /etc/yum.repos.d/convirt.repo
# yum makecache
   
Step: 4. Download the Packages on the Server :

# yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
# yum install -y Percona-XtraDB-Cluster-56
   
Step: 5. Configuring the Nodes :
   
On Node1 : i.e 192.168.100.140
========================
# vi /etc/my.cnf
   
[mysqld]
skip-host-cache
skip-name-resolve
max_connections=10000
max_connect_errors=200

datadir=/var/lib/mysql
user=mysql

# Path to Galera library
wsrep_provider=/usr/lib64/libgalera_smm.so

# Cluster connection URL contains the IPs of node#1, node#2
wsrep_cluster_address=gcomm://192.168.100.140,192.168.100.142

# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW

# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB

# This is a recommended tuning variable for performance
innodb_locks_unsafe_for_binlog=1

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2

# Node #1 Address
wsrep_node_address=192.168.100.140

# SST Method
wsrep_sst_method=xtrabackup

# Cluster Name
wsrep_cluster_name=my_centos_cluster

# Authentication for SST Method
wsrep_sst_auth="sstuser:s3cret"
wsrep_replicate_myisam=1

-- Save & Quit (:wq)
       
Step: 6. Start the first Node with the Following Command :
   
# /etc/init.d/mysql bootstrap-pxc

OR

# /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
   

Step: 7. Now, Login to MySQL and check the Cluster Status :

# mysql -u root

mysql> show status like 'wsrep%';


Step: 8. Change the MySQL root Password :

# mysql -u root
   
mysql> UPDATE mysql.user SET password=PASSWORD("redhat") where user='root';
mysql> FLUSH PRIVILEGES;

Step: 9. In order to perform Successful State Snapshot Transfer using XtraBackup new user Needs to be set up with proper Privileges :

# mysql -u root -p
Enter Password:

mysql> CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 's3cret';
mysql> GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
mysql> FLUSH PRIVILEGES;
   
Note: MySQL root account can also be used for setting up the SST with Percona XtraBackup, BUT it's recommended to use a different (non-root) user for this.
   
Node 2 : i.e 192.168.100.142
======================

# vi /etc/my.cnf
   
[mysqld]
skip-host-cache
skip-name-resolve
max_connections=10000
max_connect_errors=200

# Path to Galera library
wsrep_provider=/usr/lib64/libgalera_smm.so

# Cluster connection URL contains IPs of node#1, node#2
wsrep_cluster_address=gcomm://192.168.100.140,192.168.100.142

# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW

# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB

# This is a recommended tuning variable for performance
innodb_locks_unsafe_for_binlog=1

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2

# Node #2 address
wsrep_node_address=192.168.100.142

# Cluster name
wsrep_cluster_name=my_centos_cluster

# SST method
wsrep_sst_method=xtrabackup

# Authentication for SST method
wsrep_sst_auth="sstuser:s3cret"
wsrep_replicate_myisam=1

-- Save & Quit (:wq)

Now Start the Cluster on Node 2 :
       
# service mysql restart
# mysql -u root -p
Enter Password:

mysql> show status like 'wsrep%';

  















Testing :
======

A. Creating the new Database on the Node2 :

mysql> CREATE DATABASE test;

B. Creating the Example Table :

mysql> USE test;
mysql> CREATE TABLE example (node_id INT PRIMARY KEY, node_name VARCHAR(30));

C. Inserting Records on the Node1 :

mysql> INSERT INTO test.example VALUES (1, 'test1');

D. Retrieving all the Rows from that Table on the Node2 :

mysql> SELECT * FROM test.example;









Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Friday 8 April 2016

MySQL Important Useful Commands

MySQL Important Useful Commands

MySQL Important Useful Commands:

1. MySQL Dump For Single Database :

#
mysqldump --force --opt --single-transaction --lock-tables=false --skip-events --user=root --password=password --routines --databases shockable > /tmp/shockable.sql

2. MySQL Dump For All Databases :

#
mysqldump --force --opt --single-transaction --lock-tables=false --skip-events --user=root --password=password --routines --all-databases > /tmp/all_backups.sql

3. Restore Database from MySQL Dump :

#
mysql -u root -ppassword < /tmp/all_backups.sql

4. Restore a Single Database from All_Databases :

#
mysql -u root -p --one-database destdbname < /tmp/all_databases.sql

5. Backup A Single Table (Table Name: users) :

#
mysqldump -u root -ppassword database_name users > /tmp/users.table.sql

6. Restore that Table :

mysql>
create database database_name;
mysql>
exit

#
mysql -u root -ppassword database_name < /tmp/users.table.sql

7. MySQL Ignore Table :

#
mysqldump -u username -ppasswword --ignore-table=dbname.tablename dbname > /tmp/dbname.sql

8. Show MySQL Database size:

#
mysql -u root -p
Enter the Password:

SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;

OR
SELECT 'Total DB Size' SizeInMB,
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB"
FROM information_schema.TABLES
where table_schema not in ('mysql','information_schema');


9. To view individual Database Size in MySQL :

#
mysql -u root -p
Enter the Password:

SELECT table_schema                                        "DB Name",
   Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM   information_schema.tables
GROUP  BY table_schema;

OR
SELECT table_schema,
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB"
FROM information_schema.TABLES
where table_schema not in ('mysql','information_schema','performance_schema')
group by table_schema
order by 2 desc;


10. MySQL Cluster Status :

#
mysql -u root -p
Enter the Password:

mysql> show status like 'wsrep%';

11. To Check MySQl Cluster is Synced or Not :
# /usr/bin/clustercheck root root_password

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 

Thursday 28 January 2016

How to Install Latest MySQL 5.7.9 on Centos/RHEL 6x

Install Latest MySQL 5.7

Step: 1. Download the MySQL 5.7 Repository :

# cd /tmp
# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm (For RHEL/CentOS 6)
# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm (For RHEL/CentOS 7)

Step: 2. Install MySQL 5.7 Repository :

# yum localinstall mysql57-community-release-el6-7.noarch.rpm  (For RHEL/CentOS 6)
# yum localinstall mysql57-community-release-el7-7.noarch.rpm  (For RHEL/CentOS 7)

Step: 3. Verify that the MySQL Yum Repository has been Added Successfully :

# yum repolist enabled | grep "mysql.*-community.*"

Step: 4. Installing Latest MySQL Version :

# yum -y install mysql-community-server

Step: 5. To Install Specific Version of MySQL from Specific Sub-Repository (Optional):

Note: You can also install different MySQL version using different sub-repositories of MySQL Community Server. MySQL series (currently MySQL 5.7) is activated by default, and the sub-repositories for all other versions (for example, the MySQL 5.6 or 5.5 series) are Deactivated by Default.

# yum-config-manager --disable mysql57-community
# yum-config-manager --enable mysql56-community

Then Run:

# yum repolist enabled | grep "mysql.*-community.*"
# yum -y install mysql-community-server

Step: 6. Start the MySQL Server :

# service mysqld restart
# chkconfig mysqld on

Step: 7. Change the MySQL Password Policy :

# vi /etc/my.cnf

Add these 3 lines below [mysqld]

validate_password_policy=LOW
validate_password_length=6
validate_password_dictionary_file=YES
validate_password_special_char_count =0
validate_password_mixed_case_count = 0

-- Save & Quit (:wq)

# service mysqld restart

Step: 8. Set MySQL Root Password :

# grep 'temporary password' /var/log/mysqld.log

Output: A temporary password is generated for root@localhost: zB#cXVhVb3(c

Step: 9. Check the root Login & Password Policy :

# mysql - u root -p
Enter password: zB#cXVhVb3(c

mysql> SHOW VARIABLES LIKE 'validate_password%';

+----------------------------------------+--------+
| Variable_name                                       | Value    |
+----------------------------------------+--------+
| validate_password_dictionary_file          |             |
| validate_password_length                      | 6          |
| validate_password_mixed_case_count   | 0          |
| validate_password_number_count         | 1          |
| validate_password_policy                      | LOW   |
| validate_password_special_char_count  | 0          |
+----------------------------------------+--------+
6 rows in set (0.07 sec)

mysql> exit

Step: 10. Change the Root Password :

# mysql_secure_installation

Enter password for user root: zB#cXVhVb3(c

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: redhat123
Re-enter new password: redhat123

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Step: 11. Allow Root Login from Remote :

# mysql -u root -predhat123

mysql> grant all privileges on *.* to root@'%' identified by 'redhat123' with grant option;
mysql> exit

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Copyright © 2016 Kousik Chatterjee's Blog