The daily tech lifestyle.

Wednesday, September 27, 2017

Installing MySQL on Ubuntu 14.04






MySQL is very popular on database management used for a web and server applications this guide will help you how to install, configure manage mysql dashnetwork

We recommend to use high memory with this guide


Step 1: CHECK YOUR HOSTNAME

1. hostname
2. hostname -f

The first command show your short hostname,


Step 2: UPDATE YOUR SYSTEM

1. sudo apt-get update
2. sudo apt-get upgrade


Step 3 : INSTALL MYSQL

During the installation you will prompted some other question on your setting and configuring on your MySQL

1. sudo apt-get install mysql-server




Use MySQL
The Standard tool for interacting with MySQL is the mysql on client,

Root Login

1. login to MySQL as the root user,
      1. mysql -u root -p

2. Prompted Enter the root password
You'll then be prensented with the MySQL monitor output

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 mysql>

CREATE NEW MYSQL USER AND DATABASE

in the test youll be creating "testdb" and user "testuser" and the password is "password"

create database testdb;
create user 'testuser'@'localhost' identified by 'password';
grant all on testdb.* to 'testuser';

You can shorten this process by creating the user while assigning database permissions

create database testdb;
grant all on testdb.* to 'testuser' identified by 'password


EXIT MYSQL


# exit


CREATING SAMPLE TABLE


1. login back as "testuser"

mysql -u testuser -p

2. Create a sample table "customers"

use testdb;
create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);

Then EXIT MYSQL


TO RESET MYSQL ROOT PASSWORD


If you forget mysql root password you can do this steps

1. Stop current MySQL running server

- sudo service mysql stop

2. Use dpkg to re-run the configuration process on MySQL

- sudo dpkg-reconfigure mysql-server-5.5

3. Start MySQL

- sudo service mysql start

4. Check status on MySQL

- sudo service mysql status


Now you will be able to login again as root : "mysql -u root -p"




No comments:

Post a Comment