Basic Guide: Install MySQL Server On Ubuntu

Monday, August 15th 2016. | how to

#howto ,#tutorial #VPS – Basic Guide: Install MySQL Server On Ubuntu – This tutorial explains step by step guide (with pics) about Basic Guide: Install MySQL Server On Ubuntu

Even not all PHP scripts are requiring to use MySQL database (Rapidleech for instance), but most of CMS (Content Management System) scripts are requiring database to store various kind of data in it. In shared hosting with cPanel you can simply use PhpMyAdmin to manage all databases. Yet there is also a special menu where you can create new database, create new user, and assigning custom privilege to that user. But what if you wish to use MySQL in an unmanaged server without cPanel (or any other similar control panel) in it? Obviously all you need is Putty or Terminal, some basic Linux skill and a good Internet connection to access your server via SSH.

Previously, I posted how to install Apache web server and PHP5 on Ubuntu-based server. Today I will show you how to install MySQL and how to do some basic tasks with it.

p.s: When I say “server” it refers to both VPS or Dedicated server

Requirements

  1. A working Ubuntu server. In this guide I am using Ubuntu 12.04 (see my playground server)
  2. Windows users should download Putty while Mac and Linux users can simply use Terminal
  3. You’ll also need a basic skill to use Putty and to navigate through SSH. Read: Most common Unix commands used to SSH.
  4. About 15 minutes of your time and a cup of tea if you like.

Step 1. Login to your server

By reading this guide I assume you have a working Ubuntu server already and you knew how to use Putty and loggin to your server. You may firstly install Apache and PHP5 on your server you can do that later after installing MySQL. That’s your choice.

Also, do not forget to follow initial server setup essential for Ubuntu.

Step 2. Install MySQL server

Here it is a basic command to install MySQL on your server. First thing first, if you disabled root login following our previous guide, then execute this command first. Otherwise you don’t need to..

sudo su

You may also need to update and upgrade apt if you didn’t do it yet.

apt-get update
apt-get upgrade

Then here it is the main command to install MySQL:

apt-get install mysql-server

install mysql

If you are using Apache2 and PHP5, you can also use following command instead of default one above:

apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

If you are using another webserver you can also try to also install MySQL Tuner mod but obviously you’ll need to adjust some settings.

apt-get install mysql-server mysqltuner

Once you’ve executed one of above commands, you’ll be asked to enter / define password for user root. Enter the password twice.

install mysql

Q: MySQL didn’t ask me to enter password. What should I do?
A: You can run another command to enter new password:

mysqladmin -u root password NEWPASSWORD

change “NEWPASSWORD” with your own password.

So you are now having MySQL server installed on your server. By having Apache, MySQL and PHP5 on your Linux Ubuntu it means you’ve already deployed LAMP (Linux, Apache, MySQL and PHP). The next thing you should learn is some basic commands to do basic task on MySQL like adding new user, create new database, and so on.

I will cover that later in the next post. Meanwhile if you have question regarding the installation process simply drop the comment below..

This post Basic Guide: Install MySQL Server On Ubuntu is part of ServerMom.

Source link