compared with
Current by Nata Ramanenka
on Sep 14, 2012 01:42.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (21)

View Page History
h3. Using Command Line Interface

1. First, log in over {color:blue}ssh{color} {{ssh}} to the remote MySQL database server. To do this, on Linux or Mac, open the terminal and execute the command:

{code}ssh user@mysql.server.com{code}
!mysql-ssh.png!

On Windows, you can use the PuTTy utility. Download it from this page - [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html] \- launch it, enter "{color:blue}mysql.server.com{color}" "{{mysql.server.com}}" in the "Host name (or IP address)" input field, and click on the "Open" button.

!2.png!
!login-as-user.png!

2. When the connection is established, you have to open the MySQL server configuration file {color:blue}my.cnf{color} {{my.cnf}} in a text editor such as {color:blue}vim{color}. {{vim}}.
{info:title=Tip}
* If you are using Debian GNU/Linux, or installed MySQL using yum on Fedora/CentOS, the full path to the {color:blue}my.cnf{color} {{my.cnf}} file is {color:blue}/etc/mysql/my.cnf{color}. {{/etc/mysql/my.cnf}}.
* If you are using Red Hat Linux/Fedora/Centos Linux and installed MySQL from {color:blue}rpms{color} {{rpms}} downloaded from {color:blue}dev.mysql.com{color}, {{dev.mysql.com}}, the full path to the {color:blue}my.cnf{color} {{my.cnf}} file is {color:blue}/etc/my.cnf{color}. {{/etc/my.cnf}}.
{info}

Where,
* *bind-address* \- Contains an asterisk, meaning that the service should bind to all available IP addresses.
* *skip-networking* \- Do not listen for the TCP port at all. All interactions with {color:blue}mysqld{color} {{mysqld}} must be made via the Unix domain socket. This option is highly recommended for systems where only local requests are allowed because it provides more security. Since you need to allow a remote connection, this line should be removed from {color:blue}my.cnf{color} {{my.cnf}} or commented out.

!bind.png!

4. Restart the {color:blue}mysql{color} {{mysql}} service.

{code}# /etc/init.d/mysql restart{code}
!allow09.png!

7. Make sure that there is no firewall that blocks connections to TCP port 3306 of the MySQL server from the CDP Server. It is not always possible to check all the firewalls between one server and the other. But you can always check local {color:blue}iptables{color} {{iptables}} firewall on the MySQL server. To add the rule that permits connections to TCP port 3306 from CDP Server with IP address 202.202.200.20, execute the following command:

{code}iptables -A INPUT -s 202.202.200.20 -m tcp -p tcp --dport 3306 -j ACCEPT{code}

Where,
* *\-h IP or hostname* \- {color:blue}mysql.server.com{color} {{mysql.server.com}} is the hostname (FQDN) of MySQL server.
* *\-u r1soft* \- Log in as MySQL user r1soft.
* *\-p* \- Prompt for password.
\\

In the following example, it is assumed that the IP address of the CDP Server is {color:blue}202.202.200.20{color} {{202.202.200.20}} and that the CDP Server will connect with username {color:blue}"r1soft"{color} {{"r1soft"}} and password {color:blue}"r1soft"{color} {{"r1soft"}} without quotes.

1. First, open phpMyAdmin in your browser and log in.

4. On the "Add a New User" window, do the following:
* Enter {color:blue}"r1soft"{color} {{"r1soft"}} in the "User name" field.
* Select the "Use text field" option from the drop-down menu next to "Host" and enter {color:blue}202.202.200.20{color} {{202.202.200.20}} in the field next to the option list.
* Enter "{color:blue}r1soft{color}" "{{r1soft}}" in the "Password" and "Re-type" fields.
* Click "Check all" next to "Global privileges."

!phpmyadmin-added.png!

5. Repeat steps 2-4. This time, type "{color:blue}127.0.0.1{color}" "{{127.0.0.1}}" instead of "{color:blue}202.202.200.20{color}" "{{202.202.200.20}}" in the "Host" field.

6. Repeat steps 2-4 again. This time select "Local" in the option list next to the "Host" field. You will not have to type {color:blue}"localhost"{color} {{"localhost"}} in the input field as it will appear there automatically.

!phpmyadmin-localhost.png!
[HeidiSQL|http://www.heidisql.com/]([http://www.heidisql.com/]) is a freeware Windows application written in Delphi. It is popular among web developers because of its intuitive interface and ease of use. It can be installed on a laptop and can be used for managing MySQL servers that do not have phpMyAdmin installed.

In the following example, it is assumed that the IP address of the CDP Server is {color:blue}202.202.200.20{color} {{202.202.200.20}} and that the CDP Server will connect with the username {color:blue}"r1soft"{color} {{"r1soft"}} and password {color:blue}"r1soft"{color} {{"r1soft"}} without quotes.

1. First, launch HeidiSQL and press the "New" button to enter MySQL server credentials.

5. Then do the following:
* Enter "{color:blue}r1soft{color}" "{{r1soft}}" in the "User name" field.
* Leave the default value "{color:blue}localhost{color}" "{{localhost}}" in the "From host" field.
* Enter "{color:blue}r1soft{color}" "{{r1soft}}" in the "Password" and "Repeat password" fields.
* Check the box next to "Global privileges."

!13_php.png!

7. Repeat step 4. This time enter {color:blue}127.0.0.1{color} {{127.0.0.1}} in the "From host" field.

8. Repeat step 4. This time enter {color:blue}202.202.200.20{color} {{202.202.200.20}} in the "From host" field.

9. Click on the "Close" button to close the "User manager" window.