Ubuntu: Install MySQL & Create A Database/User

In this post I will show you how to install MySQL on Ubuntu 12.10 and how to create a MySQL user and MySQL database afterwards using the Terminal. First thing you will need to do is open a Terminal (CTRL+ALT+T is a short-cut to open the terminal).

mysql logo ubuntu Ubuntu: Install MySQL & Create A Database/User

Install MySQL On Ubuntu

You can install MySQL on Ubuntu 12.10 using the following command in your new terminal window. It will prompt you for your MySQL root password during installation automatically.

sudo apt-get install mysql-server

Create A MySQL Username

Login To The MySQL Server

Before you can run any MySQL commands or queries you have to login to your server, you can do that with the following command.

mysql -u root -p

Create The Database

After you have logged into the MySQL server you can create a database using the following command/query. (You must have the semicolon at the end.)

create database database-name;

Create And Assign A User To The Database

The command below will create and assign a user with All privileges to your database. You can visit the other post I wrote if you would like to by clicking on the following link limit MySQL user. You need to make sure that the username you choose isn’t already taken before you add/assign a user.

grant all on database-name.* tousername@localhost;

I hope this post helped you get MySQL Server on Ubuntu, please don’t forget to share/like/plus-one. There are more posts on the way! =)

Incoming search terms: