Client connection to MySQL error

Source: Internet
Author: User

3 people read

This error occurs if you want to connect to your MySQL:

ERROR 1130:host ' 192.168.16.145 ' isn't allowed to connect to this MySQL server

    1. Change the table method.

It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"

Mysql-u root-pvmwaremysql>use mysql;mysql>update User Set host = '% ' where user = ' root '; Mysql>select host, use R from user;


2. Authorization law.


(1) Example: you want to myuser use MyPassword from any host to connect to the MySQL server

GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;

(2) If you want to allow the user to connect to the MySQL server myuser from the IP 192.168.16.145 host and use MyPassword as the password

GRANT all privileges on * * to ' root ' @ ' 192.168.16.145 ' identified by ' MyPassword ' with GRANT OPTION;

(3) The last sentence must be added!!!

Mysql>flush privileges;


The following error occurred:

Communications link Failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has no received any packets from the server. Java.net.ConnectException:Connection Refused:connect

At this point, you need to log in to the server and set up your MySQL and restart MySQL as follows

Vim/etc/mysql/my.cnf

Configure the bind-address inside = 127.0.0.1
This one changed to Bind-address = 0.0.0.0
Cancel MySQL Server binding to the address!
Save exit after (Wq)

Sudo/etc/init.d/mysql Restart (restart MySQL service) or sudo service MySQL restart


Client connection to MySQL error

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.