Drupal and mysql workbech

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
abdelrahman's picture

How can I make the drupal connect with other database on mysql workbench , I need to create new module or what?

Comments

setup a database connection in MySQL Workbench

ricardoj.m.pinto@gmail.com's picture

@abdelrahman 1. open mysql workench, and add the mysql connection in the home window or or go to the database menu and click manage connections, here you can add a new one.

2. to setup a new connection in mysql workbench use the information of your drupal setup available in your /sites/default/settings.php file, the database array, e.g:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'database_name', // your database name
      'username' => 'root_user', // your database user
      'password' => 'password', // the database user password
      'host' => 'localhost', // leave this as default 'localhost'
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

Ricardo Pinto
Web developer

Adding mysql connection in the home window

matmoz1's picture

What do you write in the field after you click on manage connections to add a new one in mysql workbench? Do I add the URL from the website that the database will connect to? Thank you!