Database administration

Connection parameters

To connect to a database, you need four parameters.

We have for example the database “testdatabase” created for the domain “example.com”, the password is “toto”.

  • Server: The server you are connecting to (example: localhost)
  • User name: The name of the user (example: testdatabase)
  • Password: the password (example: toto)
  • Name of the database: the name of your database, at Online.net the user name and the name of the database are always the same (example: testdatabase)

Phpmyadmin

You have multiple options for the administration of your MySQL database:

The required credentials are these you have specified in your management console (Login: an unique identifier + the password)

If you can't connect to http://phpmyadmin.online.net using your credentials and you are seeing an error message like the following:
#2005 - Unknown MySQL server host 'localhost' (1)
You must try to empty the cache of your web browser, it might have kept your old phpmyadmin sessions in the memory.

Adminer

To administer your PostGreSQL databases, an Adminer web interface is available.

To connect to the Adminer interface, click on the Link “Server” in the list of your databases:

The required credentials are these you have specified in your management console (Login: an unique identifier + the password).

From PHP

You can find an example how to connect in your management console,

  1. Login to your management console.
  2. Go to the tab “SQL”
  3. You will find the list of your databases just below the form for creating new ones:
    • Select your database in the list
    • Choose “PHP script example” next to your database name
  4. Confirm

Below you will find a generic example for the connection to a database:

<?php
 
// replace domain.tld with your domain
// replace password with the password of your database. You have choosen the password as you created the database.
 
$host = 'localhost'; 
$base = 'dbname';
$login = 'dbname';
$pwd = 'password';
 
// Connection to the server
 
$db = mysql_connect($host, $login, $pwd);
 
// We test the connection to the server
if(!$db)
{
  // we show an error message:
  print "Sorry, impossible to connect to [$host] : ".mysql_error();
  exit;
}
 
// we select the database:
if(!mysql_select_db($base,$db))
{
  // we show an error :
  print "Sorry, the database [$base] could not be found on the server [$host]<br>".mysql_error();
  mysql_close($db);
  exit;
}
 
// we try to read every content from the table 'toto' :
 
$sql = "SELECT * FROM toto";
 
// this request generates an error if there is no table 'toto'
 
if(!mysql_query($sql,$db))
{
  // we show an error message:
  print "Error in the request $sql in the database [$base] at server [$host]<br>".mysql_error();
  mysql_close($db);
  exit;
}
 
// we close the connection
 
mysql_close($db);
 
?>

Database quotas

Note: The size of the databases does not count towards your web quota.

To maintain the maximum performance of the SQL servers, there are two limitations set:
http://www.online.net/en/hosting

  1. Maximum size of a database: 1 GB for the PERSONAL offer 5 GB for the PRO offer, 10GB for the BUSINESS offer
  2. Maximum size of a table: 100 MB for the PERSONAL offer, 500 MB for the PRO offer and 1 GB for the BUSINESS offer
  3. Maximum number of tables in a database: 2 000
  4. Number of simultaneous requests: 3 requests for the PERSONAL offer, 50 requests for the PRO offer, 75 requests for the BUSINESS offer

The databases which exceed this quota are automatically blocked. It will not be possible to add any more data to it or to do any queries. Only the option to delete data remains active.

To see the size of your database you can either connect to the mysql shell or see it in the administration interface.

We have several certified management companies who may help you with the configuration and optimization of your SQL databases: http://www.online.net/en/dedicated-server/dedicated-server-outsourcing