Did You Know?

How Can We Help?

Special Offer

Deploy your Cloud Server now and get $100 in Free Credits!

Get Started

MySQL Relational Databases on Ubuntu 12.04

Table of Content

MySQL is a relational database management system that is available for free online. You can say it like this: (RDBMS). The name comes from the combination of "My," which is the name of co-founder Michael Widenius's daughter, and the acronym for Structured Query Language (SQL).

Web and server applications frequently use the well-liked database management system MySQL.

Installing, configuring, and managing MySQL will be covered in detail in this guide.

*Installing MySQL

[console]#sudo apt-get install mysql-server[/console]

During installation, you'll be prompted to set a MySQL root password. Keep your password safe.

MySQL Relational Databases

*MySQL Server secure installation

[console]#sudo mysql_secure_installation[/console]

You can change MySQL's root password, remove anonymous user accounts, disable root database login outside localhost, and delete test databases. Yes is recommended. The MySQL Reference Manual has more details.

*Root Login

[console]#mysql -u root -p[/console]

*After run this command you will face below interface


*Make a New User in MySQL and Database

[console]#create database microhostdb;[/console]

[console]#create user 'microhost'@localhost identified by 'password';[/console]

[console]#grant all on microhostdb.* to 'microhost';[/console]

*Creating the user and assigning database access privileges at the same time can speed up the process significantly:

[console]#create database microhostdb;[/console]

[console]#grant all on microhostdb.* to 'microhost' identified by 'password';[/console]


*Produce a Model of the Table.

[console]#mysql -u microhost -p[/console]

[console]#use microhostdb;[/console]

[console]#create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);[/console]


*Password-reset MySQL root user

You can reset your root MySQL password if you forget it.

*Stop the currently running MySQL server.

[console]#sudo service mysql stop[/console]

*Use dpkg to re-run the setup process that MySQL goes through the first time it is installed. You'll be asked to set a root password once more.

[console]#sudo dpkg-reconfigure mysql-server-5.5[/console]

*You should now be able to log in once more by using the command mysql -u root -p.

*Tune MySQL

*From Ubuntu's software repositories, install MySQL Tuner.

[console]#sudo apt-get install mysqltuner[/console]

*To operate it:


The output will include two sections of interest: general recommendations and variables to tweak.

Thank You


Special Offer

Deploy your Cloud Server now and get $100 in Free Credits!

Get Started
Table of Contents