Linux/centos open MySQL remote connection, remote management database

Source: Internet
Author: User
Tags iptables phpmyadmin

When the server is not running PHP, not installed phpMyAdmin, remote management of MySQL is necessary.

First step: Turn on remote access for MySQL users

Mysql-u root-p MySQL # 1th MySQL is the execution command, and the 2nd MySQL is the system data name

In the MySQL console perform:

Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with Grant option;# root is the username,% represents any host, ' 123456 ' specified login password (this and this The root password of the ground can be set different, non-affected) flush privileges; # overloaded system permissions exit;

If you want to allow user root to connect to the MySQL service from a host that is IP 192.168.137.99:

Grant all privileges on * * to ' root ' @ ' 192.168.137.99 ' identified by ' 123456 ' with grant Option;flush privileges;

Step two: Set up a firewall to allow 3306 ports to be accessed externally

Iptables-i input-p tcp-m State--state new-m TCP--dport 3306-j accept# See if the rule is in effect Iptables-l-N # or: Service iptables status# the production environment is not secure at this time, the port should be closed after remote administration, and the rule added before the deletion iptables-d input-p tcp-m State--state new-m TCP--dport 3306-j ACCEPT

Note : the above iptables Add/Remove rules are temporary and will need to be saved if a reboot is required:

Service Iptables Save # or:/etc/init.d/iptables save

Other than that

Vi/etc/sysconfig/iptables # plus the following line of rules is also possible-a input-p tcp-m state--state new-m TCP--dport 3306-j ACCEPT

Remote management of the database software, win system can use SQLyog (), with several remote software, feel this use is pretty good.

Additional instructions If you have phpMyAdmin installed, you can also modify user permissions as follows:

Open MySQL remote connection under Linux/centos, manage database remotely

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.