Web Development

Install and create mysql database in ubuntu by ON April 18 2019

This article may help you to set-up the MySQL in ubuntu system and also show the database information.

How to Install MySQL Server using sudo :

sudo apt-get install mysql-server

How to access user into MySQL :

 sudo mysql -u root -p

Change the root user password :

ALTER USER 'username'@'hostname' IDENTIFIED WITH mysql_native_password BY 'newpassword'

Grant root user to access in a normal account without sudo rights :

FLUSH  PRIVILEGES 

How to Create New User :

GRANT ALL PRIVILEGES ON *.* TO 'username'@'hostname' IDENTIFIED BY 'password';

How to access user in normal account :

mysql -u root -p

How to drop user in mysql :

DROP USER 'username'@'hostname';

How to create database :

 CREATE DATABASE datbasename;

How to show databases :

SHOW DATABASES;

How to use the specific Database :

 USE databaseName;

Create table : We can create table by writing normal query of mysql in ubuntu.

How to check structure of table :

DESCRIBE tablename; 

If you have any query regarding this please comment.

Thank you >:)

author's avatar ALL POST
I am full stack developer and working in Node.js, Angular7, MongoDB, MySQL.
LEAVE A COMMENT

Leave a Reply

Your e-mail address will not be published. Required fields are marked *