Detailed explanations on how to use the MySQLGUI tool for remote security-MySQL

Source: Internet
Author: User
As a database, MySQL is synonymous with ease of use. most database-driven web applications choose it as their own database. For this reason, MySQL is applied to many WEB servers. Although MySQL command line tool is indeed useful, it is sometimes time-consuming to complete the task, unless you are familiar with SQL syntax, familiar with mysqlGUImysql management tool

As a database, MySQL is synonymous with ease of use. most database-driven web applications choose it as their own database. For this reason, MySQL is applied to many WEB servers. Although the MySQL command line tool is indeed useful, it is sometimes time-consuming to complete the task, unless you are familiar with the SQL syntax. For this reason, tools such as PhpMyAdmin have become so popular.

MySQLDevelopers have begun to use their own GUI tools that can be used to connect to local or remote MYSQL databases. These tools include MySQL Administrator, MySQL Query Browser, and MySQL Workbench. They are both good graphical tools that simplify the creation and operation of MySQL databases.

The problem with using these tools to operate remote databases is that they usually require you to enable MySQL to listen to WEB interfaces. most MySQL administrators only choose to enable MySQL listening for a local host or a socket, remote connection is not allowed. This is a good security habit; however, it allows you to use these GUI tools remotely without a little effort. The connection using ssh tunnel [2] (tunnel) is very effective. It not only allows high-intensity authentication and encryption, but also does not compromise the setting that MySQL only listens to local connections.

First, ensure that MySQL listens to the local host [2] (by default, it only listens to connections on the local socket ), this can be done by telling MySQL to allow WEB connection and restart the server. MySQL should be configured to only listen to loopback interfaces, local interfaces, or WEB interfaces.

Next, edit ~ /. Ssh/config file and insert the following content:

     Host remotesql?Hostname webserver.domain.com?User joe?LocalForward *:13306 localhost:3306

This will connect to webserver.domain.com as user joe and forward port 13306 (forward) on the local system to Port 3306 (this is the standard MySQL Port) of webserver.domain.com ). Note that we didn't bind the forwarded port to the local interface on the local machine, but pointed to all interfaces; this means that we can connect to Port 13306 of me.domain.com (assuming me.domain.com is the name of the local workstation), instead of connecting to Port 13306 on the local host (this is very important, these GUI tools will try to use a socket to connect to the local host, which is not what we want .) Now you can initiate a connection by executing:

     $ ssh -f -N remotesql

Finally, activate the MySQL administrator account and use your trust certificate to connect it to port 13306 (whether it is a user account or root account) of me.domain.com ). For normal connection, you may have to give a user@localhost.localdomain license.

After doing so, you will be able to use any system on the local WEB to connect to a remote database across the Internet without any risk (unless the firewall rules on the local machine block it ), in this way, you can still use the local MySQL command line tool to operate the remote database:

     $ mysql -u root -p -h me.domain.com -P 13306

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.