Monday, December 12, 2011

MySQL on the Cloud

On this post we are going to install and configure an Instance of MySQL on our remote server. Here http://www.guia-ubuntu.org/index.php?title=MySQL you can find a post talking about this same topic.

First of all we have to install the MySQL Server packages:

sudo apt-get install mysql-server


During the installation you will be asked to introduce the root password.

In order to allow connection from any client, edit /etc/mysql/my.cnf and modify bind-address with the following value:

bind-address            = 0.0.0.0

We need to do the same at operative system level, edit /etc/hosts.allow and include the following line:

mysqld: all

We also need to set a final layer of security at application level. Introduce the following command and introduce the password that you set in the installation phase:

mysql -u root -p

Once you are inside the MySQL console type (The semicolon at the end is quite important, do not miss it):

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 51
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';

After entering the above command type quit to leave the console:

mysql> quit
Bye


Now you can connect from your local pc to your remote database on the cloud. There are several interesting tools to manage and use your MySQL database server, my favorites are MySQL Administrator and MySQL Server. You can install it:

sudo apt-get install mysql-client mysql-query-browser mysql-admin


Fig.1 MySQL Administrator login


Log in with your credentials and your cloud instance identifier and enjoy!!


RESOURCES

No comments:

Post a Comment