How To Set Up LAMP Environment with Apache MySql and PHP : Part-2?
Databases Linux Tutorials

How To Set Up LAMP Environment with Apache MySql and PHP : Part-2?

In our previous article (Part 1) on setting up LAMP environment, we learned how to setup apache server. Now part 2, will help you to learn how to install MySql 5.5. You just have to follow very simple steps, with YUM manager. YUM makes it really easy by avoiding the compilation process and install them easily with installing all other dependencies and also you are notified of updates.

NOTE: If Missed You may read and apply below links

Part 1- Learn To Install Apache
Part 2- Learn To Install MySql
Part 3- Learn To Install PHP 

Scenario: My Server IP is 192.168.1.188

Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig

Step 1: Get The Remi Repository

The most f the updated package is available under Remi repository. Install it in your system using following commands.

Step 2: System Update

To ensure that every package on the server is updated. Run the following command to update package on your server

Step 3: Install MySql

Now Type in the following command to install MySql server

#yum –enablerepo=remi install mysql mysql-server

Step 4: Start MySql

Now we have installed our MySql server and we need to start the service. the following command will start the MySql server.

After hitting above command you will see following lines



Step 5: Securing With Password

When Mysql server is started then you need to secure with a password and you can do it by typing command generated above (I have Highlighted)

Soon after starting the MySql it will bind itself with localhost(127.0.0.1) on port 3306.You may see its configuration file at /etc/my.cnf. If you want to bind your public IP with MySql then you make changes in the same file. But for security, you need to add some rules in firewall for specific IP address to get connect

Step 6: MySql Server Hardening

When MySql is installed, there is some default configuration which may be the security threats. Mysql provides a script to remove few security threats known as “mysql_secure_installation”.

Now give you input to text based MySql hardening script

 Step 7: Test Your Installation

When the database server is started then we can access MySql database by using MySql client through terminal with the following command

  1. Via Root Login

After hitting Enter button you will be asked to put in your password. Enter and password then you will get the login and you will see the MySql shell display:

Few Management Command For MySql

To stop your MySql:

To start MySql, type:

To restart the service again, type:

To Restart automatically when the server is rebooted:

To generate a list of commands for the MySQL prompt, enter \h. You’ll then see:

Thanks for Reading, I hope this information was good enough

Part 1- Learn To Install Apache
Part 2- Learn To Install MySql
Part 3- Learn To Install PHP 


Kapendra
Love to write technical stuff with personal experience as I am working as a Sr. Linux Admin. and every day is a learning day and Trust me being tech geek is really cool.
http://kapendra.com

Leave a Reply