Time for action – installing and setting up MySQL
Let's get MySQL installed and configured with the basic databases and access rights.
On an Ubuntu host, install MySQL using
apt-get
:$ apt-get update $ apt-get install mysql-server
Follow the prompts, and when asked, choose a suitable root password.
Once installed, connect to the MySQL server:
$ mysql -h localhost -u root -p
Enter the root password when prompted:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 40 … Mysql>
Create a new database to use for the examples in this chapter:
Mysql> create database hadooptest;
You will receive the following response:
Query OK, 1 row affected (0.00 sec)
Create a user account with full access to the database:
Mysql> grant all on hadooptest.* to 'hadoopuser'@'%' identified by 'password';
You will receive the following response:
Query OK, 0 rows affected (0.01 sec)
Reload the user privileges to have the user changes take effect:
Mysql> flush privileges...