How to enable MySQL remote connection on a Linux Server

Source: Internet
Author: User

How to enable MySQL remote connection on a Linux Server

Method/step

• Step 1

Remotely connect to the Linux system and ensure that the MySQL database is installed on the Linux system. Log on to the database. How to enable MySQL remote connection on a Linux Server

Mysql-u $ user-p $ pwd

• Step 2

Create a user for remote connection

Grant all privileges on *. * TO '$ username' @' % 'identified by' $ password' with grant option; $ username indicates the user name, and % indicates that all computers can be connected, you can also set an IP address to run the connection. $ password indicates the password.

• Step 3

Run flush privileges. The command takes effect immediately.

Flush privileges; • Step 4

Database Query user

Select distinct concat ('user: ''', User, ''' @ ''', host, '''; ') AS query FROM mysql. user;

• Step 5

Open vim/etc/mysql/my. cnf

Bind-address = 127.0.0.1

Set to bind-address = 0.0.0.0 (device address)

Restart

/Etc/init. d/mysql restart • view the global port of MYsql (3306 by default)

# View the port number

Show global variables like 'Port ';

The configuration has been completed.

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.