NOTE: This is an old article. Please go to the Meshlium development section in order to get the latest tutorials.

Configure Mysql in Meshlium so a user can access from internet to a database

Requeriments:

  • At least one Meshlium configured to have access to internet

This Howto will show how to create a database and a user that have privileges to access from internet.

First step is to modify default configuration for Mysql to allow access from other machines. We must modify the file /etc/mysql/my.cnf

# Comment next line in /etc/mysql/my.cnf

# bind-address - 127.0.0.1

Now we have to create the user and datebase in mysql. Just follow the next steps.



Connect mysql as root

	octavio@abejorro:~$ mysql -h localhost -u root -p
	Enter password:
	Welcome to the MySQL monitor.  Commands end with ; or \g.
	Your MySQL connection id is 12
	Server version: 5.0.45-5 (Debian)

	Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

	mysql>
	


Now make the database

	mysql> CREATE DATABASE just_a_try;
	


Use created database

	mysql> USE just_a_try;
	Database changed
	mysql>
	


Create a new user that can access database from everywhere.

	mysql> GRANT ALL PRIVILEGES ON just_a_try.* TO 'new_user'@'localhost' IDENTIFIED BY 'new_user_pass' WITH GRANT OPTION;
	Query OK, 0 rows affected (0.01 sec)

	mysql> GRANT ALL PRIVILEGES ON just_a_try.* TO 'new_user'@'%' IDENTIFIED BY 'new_user_pass' WITH GRANT OPTION;
	Query OK, 0 rows affected (0.00 sec)

	mysql> FLUSH PRIVILEGES;
	Query OK, 0 rows affected (0.00 sec)
	


To revoke privileges to a user if needed in a future just do:

	mysql> REVOKE * ON just_a_try.* FROM new_user;
	Query OK, 0 rows affected (0.05 sec)
	

Now new_user can access just_a_try database from anywhere if he has access to Meshlium.

Alert: For production enviroments you should allways apply a security police. This howto don't configure any security options.


© Libelium Comunicaciones Distribuidas S.L.

| Terms of use