Basic Guide: Install MySQL Server On CentOS
#howto ,#tutorial #VPS – Basic Guide: Install MySQL Server On CentOS – This tutorial explains step by step guide (with pics) about Basic Guide: Install MySQL Server On CentOS
Easy and simple way to install MySQL on CentOS VPS or Dedicated server. A guide posted for newbie to learn how to build working server to host a website. MySQL is part of either LAMP or LNMP stack. I shared already about how to install Apache web server and PHP5 on CentOS, today you will see how to get MySQL installed on your server as well so you will have fully LAMP stack installed. We will talk about Nginx in another post.
MySQL plays important role in many dynamic website nowadays because it provides a solid platform to use, store, manage, organize and querying database. Yet, it is also lightweight. Without further chit chat, follow steps below to install MySQL on your server.
- A working CentOS server. In this guide I am using CentOS 6.3 x32 (see my playground server)
- Windows users should download Putty while Mac and Linux users can simply use Terminal
- You’ll also need a basic skill to use Putty and to navigate through SSH. Read: Most common Unix commands used to SSH.
- About 15 minutes of your time and a cup of tea if you like.
Step 1 – Login to your server and follow my previous guide about Basic setup for CentOS before you build a live web server. You may and may not follow that tutorial but if you followed, it will give you some basic security tweak to your server.
Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch as root.
Step 2 – Install MySQL using yum on CentOS. Issue following command:
yum install mysql-server
Type the basic command above and hit Enter. Screenshot:
It will ask for confirmation, simply type Y then hit Enter again:
Once done it’ll display the Complete! message:
Step 3 – Alright! You’ve installed MySQL on your server. It’s time to start MySQL main service. Issue this command
service mysqld start
As usual, it should display the OK message indicating everything’s fine:
Step 4 – Setup MySQL root password. Your server has “root” user but MySQL also has its own. It means your server’s root password is not similar as root password for MySQL. Go ahead set a root MySQL password by issuing this command:
It will then ask you to enter current password. As you never set it up previously, so simple hit Enter (because currently there is no password).
Next, you’ll be asked: Set root password? [Y/n]. Type Y and hit Enter then type in your new password twice.
Yet, you’ll also be asked for several questions. Simply answer with Y to move on.
Remove anonymous users? [Y/n] y ... Success! Disallow root login remotely? [Y/n] y ... Success! Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reload privilege tables now? [Y/n] y ... Success!
At the end, it will say: Thanks for using MySQL!
That’s it. Now your server is really ready to host a website as it already has Apache, MySQL and PHP installed on it.
Top Most Common Basic MySQL Commands.
Do not hesitate to drop a comment below with questions, opinion, tips and tricks of your own. For quick and easy update you can follow me on Twitter.
This post Basic Guide: Install MySQL Server On CentOS is part of ServerMom.