Installing MySQL on Ubuntu and CentOS
14 Oct 2013 Devops for Dummies 4
MySQL is one of the most famous Open Source Relational Database Management System (RDBMS) created by Michael Widenius. Default choice in systems as WordPress and used by top companies as Google and Wikipedia. Due its simplicity and large community, it is largely used by developers and webmasters around the world.
MySQL is under dual license: one Open Source under GNU General Public License and another commercial from Oracle, the owner of MySQL.
In this first post about DB Series, let’s install MySQL on Ubuntu and CentOS.
Installing on Ubuntu Server
$ sudo apt-get install mysql-server
In Ubuntu, you will be asked to input root password. It is not recommendable but you can let it blank.
Installing on CentOS
$ sudo yum install mysql-server mysql
Installing MySQL is the simple and it is already running. MySQL runs as a service, if it not started just type:
$ sudo service mysqld start
Accessing via terminal
$ mysql -uroot -p
The option -u means that you want to login with root user and option -p that you will enter the password (don’t type it in the terminal!!!). You be required to enter the root’s password. If it is your first access, just enter and voilá! You are in MySQL Console.
The first recommended operation is to set a password to root user:
> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new password');
You should To exit, type:
If you are not familiarized with SQL Commands, I recommend you study at SQL Tutorials – W3 School.
Image from MySQL.