Client cannot connect to MySQL problem

Source: Internet
Author: User
Tags mysql in

The MySQL in this article is installed in the Linux virtual machine, the client is the Dbeaver on the physical host
Youdao Cloud notes directly pasted over, the format is too messy, it is recommended to view this Youdao cloud notes link

Make sure there are users who can link anywhere

Use the following SQL query in Linux

The query results are as follows

+-----------+------------------+| host       | user               |+-----------+------------------+| %             | admin            || 127.0.0.1 | admin            || localhost  | debian-sys-maint || localhost  | mysql.session    || localhost  | mysql.sys        || localhost  | root             |+-----------+------------------+

Need to ensure that the following results are present

+-----------+------------------+| host      | user             |+-----------+------------------+| %         | admin            |+-----------+------------------+

If it exists, you can use the Admin user to log in (from anywhere);
If it does not exist, then you can add a corresponding user record to the specific grant command see the official website document

mysql> grant all on yourdb.* to [email protected]‘%‘ identified by ‘yourpassword‘; //注意这里的yourdb和yourpassword换成自己实际的值   
Modify the bind-address in the MySQL configuration file

If you are using a virtual machine, you may also need to look at the IP issues under the bindings
Use the following command

mysqld --verbose --help | grep bind-address

The results are shown below

--bind-address=name IP address to bind to.bind-address                                                 0.0.0.0

Need to be sure that your bind-address must be 0.0.0.0
The bind address has a to is 0.0.0.0 (which means "every IP addresses") to work.

So how do you change this bind-address?
Locate your mysqld.cnf file, search for bind-address and then modify
In general Linux, this file is in the/ETC/MYSQL/MYSQL.CONF.D directory

Reference

Refer to GitHub's content (see 7 floor)

Client cannot connect to MySQL problem

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.