In Linux, MySQL cannot be remotely connected.

Source: Internet
Author: User

System Environment: Linux CentOS-6.4-64bit

During the MySQL setup process, the default Root account can only be accessed from the local machine. If you want to access the MySQL database on Linux through other machines, you must make some configuration, next I will introduce my solutions. First, use the Root account to enter MySQL from the command line, and then configure it as follows:

1. The following statement grants access permissions to the corresponding account. Fill in the required 'username' and 'Password' sections

Grant all privileges on *. * to 'username '@' % 'identified by 'Password' with grant option;

2. Write Permission

Flush privileges;

3. Restart the database

Service mysqld restart

When the network is running, I find that the MySQL database in Linux cannot be remotely connected after the above configuration. Later, I found out that the firewall was at fault. There are still two solutions: one is to add Port 3306 in the configuration file, and the other is to close the firewall directly, currently, I use the second method to directly disable the firewall. Next, I open the terminal and enter setup. The following interface will appear:

Press enter to enter the following page:

Use the Space key to select whether to enable the connection. After I disable the function, connect to the remote client and find that the connection is now available. The problem has been solved successfully.

Recommended reading:

Linux website architecture series-Apache-deployment

Complete MySQL installation and master-slave dual-machine configuration

Install MySQL database in rpm mode on RHEL6 Platform

RedHat 6.3 MySQL-server-5.6.13-1.el6.x86_64.rpm Installation

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

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.