Welcome to LSI.
This document will show you how to establish a connection with the MySQL server. It will also talk about how to access the service in two ways: in graphical mode using phpMyAdmin web environment, or in textual mode (by the command line interface). Finally, some examples about how to connect to the service from PHP and MySQL will be given.
Server name: mysql-rdlab.lsi.upc.edu
You can get a username and password by mail at email@example.com or by web at http://rdlab.lsi.upc.edu/index.php/en/services/resources-request.html.
NOTE: Database name will be the same as your username.
With your username and password you will be able to access the service from the webpage provided by RDlab:
Note: Secure connection is also available through the URL:
Once in, the page will show a form where you will be asked for your MySQL username and password.
After the data is entered you will access the main page. This interface allows creating tables, deleting them, querying data and modifying information.
In order to connect in textual mode (terminal or Command Line Interface) we can type this command while in a Unix system:
mysql -u <username> --host=mysql-rdlab.lsi.upc.edu -p
The command line will answer “Enter password:”, where we should enter our password. Once authenticated, we will be able to execute any command we want by the command line interface.
By using the command “SHOW DATABASES;” we will see that a database named like our username is available. To select it, we will execute the following:
If we want to establish connection from a PHP environment, we can do it by using the next code snippet:
$host = "mysql-rdlab.lsi.upc.edu";
$login_name = "<username>";
$password = "<password>";
$database = "<username>";
MySQL_connect("$host","$login_name","$password") or die("No em puc connectar a la BD");
MySQL_select_db("$database") or die("No puc sel·leccionar la BD");
n order to establish connection from a java project, it is necessary to download the mysql-connector-java-5.0.8-bin.jar library, add it to our project and import it with the following sentence:
Once done, we should execute the next code inside a try-catch block:
String db_connect_string = “jdbc:mysql://mysql-rdlab.lsi.upc.edu:3306/<username>”;
String db_userid =“<username>”;
String db_password = “<password>”;
Connection conn = DriverManager.getConnection(db_connect_string, db_userid,db_password);