Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Sunday, 7 February 2016

How to Install LAMP Server on Centos/RHEL 6.X

LAMP Server on Centos/RHEL 6.X

Step 1: Install Apache

# yum -y install httpd httpd-devel

Start httpd Service

#/etc/init.d/httpd start

Edit httpd.conf file

# vi /etc/httpd/conf/httpd.conf

### Just Add this Line
#ServerName www.example.com:80
ServerName (ip address of server):80

--- Save & Quit (:wq) ---

Step 2: Go to /var/www/html and Make A HTML page

# vi index.html

Restart httpd Service:

#/etc/init.d/httpd restart

Step 3: Install MySQL Database Server

# yum -y install mysql mysql-server mysql-devel

Start Mysqld Service

# /etc/init.d/mysqld start

Changing MySQL Root Password:

# mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('sql') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit

Check by logging:

#mysql -u root -p
Enter Password:

mysql> show databases;
++
| Database |
++
| information_schema |
| mysql |
++
2 rows in set (0.00 sec)

mysql> exit

Step 4: Install PHP5 Scripting Language

# yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

Step 5: Create a file named /var/www/html/info.php

# vi /var/www/html/info.php

phpinfo();
?>

--- Save & Quit (:wq) ---

# /etc/init.d/httpd restart

Step 6: Then point your browser to http://ip address/info.php

http://(Your-IP/Hostname)/info.php

Step 7: Download this phpMyAdmin rpm

# cd /var/www/html
# wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.14/phpMyAdmin-4.0.10.14-all-languages.tar.gz

Extract the tar File & Rename it :

# tar -zxvf phpMyAdmin-4.0.10.14-all-languages.tar.gz
# ls
# mv phpMyAdmin-4.0.10.14-all-languages phpmyadmin
# ls

Edit the /etc/httpd/conf/httpd.conf File :

# vi /etc/httpd/conf/httpd.conf
Add those Lines :


Options +Indexes +Multiviews
DirectoryIndex index.php index.html
AllowOverride All
Allow from all

--- Save & Quit (:wq) ---

Rename the config.sample.inc.php File

# mv config.sample.inc.php config.inc.php

Step 8: Start the httpd & mysql Service on Boot & stop iptables & Disable the selinux

# chkconfig httpd on
# chkconfig mysqld on
# service iptables stop
# chkconfig iptables off
# setenforce 0

Point your browser to

http://(Your-IP/Hostname)/phpmyadmin

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

Friday, 22 January 2016

How to Install Mysql 5.7 on Centos 6.X/7.X


Mysql 5.7 on Centos 6.X/7.X

Step 1: Save the Repo File for The MySql 5.7 or Install the RPM for Mysql 5.7

# vi /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

--- save n quit (:wq) ---

or,

On RHEL/CentOS 7

# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
# yum localinstall mysql57-community-release-el7-7.noarch.rpm

On RHEL/CentOS 6

# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
# yum localinstall mysql57-community-release-el6-7.noarch.rpm

Step 2: Install Mysql 5.7

# yum install mysql-community-server -y

Step 3: Reset the Mysql Temporary root Password and Chacge the password Policy

# vi /etc/my.cnf

add these 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 and quit (:wq) ---

# service mysqld start


# cat /var/log/mysqld.log |grep "temporary password"
2015-09-06T16:46:46.109066Z 1 [Note] A temporary password is generated for root@localhost: <Password>

# mysql_secure_installation

Enter password for user root: <Enter the Temporary Password>

The existing password for the user account root has expired. Please set a new password.

New password: <New Password>

Re-enter new password: <Retype the Password>

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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? (Press y|Y for Yes, any other key for No) : y
Success.


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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

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

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

Step 4: Check the Version and Mysql Once

# mysql -u root -p<password>

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> \q
Bye

# mysql --version

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