Allow MySQL to connect remotely

Source: Internet
Author: User

MySQL error number 2003

Can't connect to MySQL Server XXX. XXX (10061)

MySQL is installed by default in Ubuntu 9.04, which can only be accessed locally by default. Google:

Use

Log on to the MySQL server and run the command in the MySQL database.

Grant all on *. * To 'remote' @ '192. 16.21.39'
Identified by 'Password ';

You can.

If you want to set any client to be able to be connected as root, you can write as follows:
Grant all on *. * To 'root' @ '%'
Identifiied by 'root password'

Format: grant select on database. * To username @ login host identified by "password"

This method is as follows:

1. Change the table. It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to MySQL on the computer of localhost, and change the "host" entry in the "user" table in the "MySQL" database to "%" from "localhost"

Mysql-u root-pvmwaremysql> use MySQL; mysql> Update user set host = '%' where user = 'root'; mysql> select host, user from user;

 

2. Authorization method. For example, if you want myuser to use mypassword to connect to the MySQL server from any host.

Grant all privileges on *. *
'Myuser' @ '%'

Identified by 'mypassword' with grant option;

 

If you want to allow myuser to connect to the MySQL server from a host whose IP address is 192.168.1.3, and use mypassword as the password

Grant all privileges on *. * To 'myuser' @ '2017. 168.1.3'
Identified by 'mypassword' with grant option;

But the problem persists:

Find the command mysql> flush privileges // make the modification take effect

Zero rows are affected.

The problem persists. Restart MySQL sudo/etc/init. d/MySQL restart.

Or not.

From http://www.blogjava.net/waterjava/archive/2008/04/27/196385.html

I learned that MySQL has a local binding and found the problem.

Edit/etc/MySQL/My. CNF

# Instead of skip-networking the default is now to listen only on
# Localhost which is more compatible and is not less secure.
Bind-address = 127.0.0.1

Annotate "bind-address = 127.0.0.1"
Sudo/etc/init. d/MySQL restart Remote Access

Problem Solving

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/helen_shw/archive/2010/01/22/5224524.aspx

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.