Magento MySQL configuration for remote connection – Part 2

In this part of the article we will discuss the codes and their implementations of Magento MySQL config file.

Let’s start creating the remote connection for the Magento MySQL config file. Here we go!!

First begin with opening Magento MySQL config file in the DB server. However, open the Magento MySQL config file as a user having privilege to access root.

Then trace the location with the following code.

mysql – help

As a as result, a display will pop up with the following results. Moreover, from the following file the built-in options can be read.

/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

But for the Ubuntu 16 users, the result might be slightly different. Generally, for Ubuntu 16 the following path will display in most cases.

/etc/mysql/mysql.conf.d/mysqld.cnf

Now find out the Magento MySQL config file for bind-address. Then in the file found change the value described below. Either leaving [mysqld] section add as following anywhere.

bind-address = <ip address of your Magento web node>

If you’ve clumped web server follow the Mage MySQL documentation.

Either exit the text editor by saving changes made to the Mage config file.

Now use the following codes to restart the MySQL service.

For CentOS user, use service mysqld restart. Or Ubuntu users can restart by service mysql restart.

Incase MySQL is unable to start off. Then check in the syslog for the resource of that error. However, use the MySQL documentation to resolve the error.

 

Granting Web node user to DB

Now enable a web node DB user to access the DB on the remote server. So the web node can connect to the DB server.

Firstly, log in to DB server.

Secondly as root user connect to MySQL DB.

Thirdly insert the following commands as following.

GRANT ALL ON <The name of local DB>.* TO <username of remote web node>@< ip address of remote web node> IDENTIFIED BY '<user pass for DB >';

 

Here is an example of granting web node user to DB.

GRANT ALL ON mage_rem.* TO admin@192.168.2.51 IDENTIFIED BY 'xyz';

Note: However, you need to enter the specific command in each web server for clustered servers. Also, must be logged in with the same username in each server.

<< Go back to Part 1 | Currently Viewing Part 2Continue to Part 3 >>