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