Enable MySQL remote connection in Linux

Source: Internet
Author: User

Enable MySQL remote connection in Linux

How to enable MySQL remote connection in Linux.

By default, the root user of MySQL can only access MySQL locally and cannot remotely connect to and manage MySQL databases. How can I enable MySQL remote connection in Linux? The procedure is as follows:

1. GRANT command to create a remote connection mysql authorized user test

Mysql-u root-p

Mysql> grant all privileges on *. * TO test @ localhost identified by 'test' with grant option;

Mysql> grant all privileges on *. * TO test @ "%" identified by 'test' with grant option;

In the first sentence, the itlogger user is authorized to access through the Local Machine (localhost) and the password is 'test '. The second sentence is to authorize the test user to initiate access from any other host (wildcard % ).

2. Set the firewall to allow port 3306

Vi/etc/sysconfig/iptables

Add

-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT

(Note that before-A RH-Firewall-1-INPUT-j REJECT -- reject-with icmp-host-prohibited, otherwise the rule may not take effect)

Restart Firewall service iptables restart

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

Related Article

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.