Today, I used myeclipse's dB explorer to connect to MySQL installed on ubuntu8.04. An error is always prompted, but access to Ubuntu is normal. So I started to find the cause:
1.
Port 3306 is not enabled?
Run the nestat command to view the status of port 3306:
~ # Netstat
-An | grep 3306
TCP
0 0 127.0.0.1: 3306 0.0.0.0: * listen
The result shows that port 3306 only listens to the IP address 127.0.0.1, so access from other IP addresses is denied.
Solution: Modify the/etc/MySQL/My. CNF file. Open the file and find the following content:
# 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
Comment out the above line or replace 127.0.0.1 with a suitable IP address. We recommend that you comment out this line.
After restarting, use netstat again for detection:
~ #
Netstat-an | grep 3306
TCP 0 0 0.0.0.0: 3306 0.0.0.0: * listen
2.
Is the problem solved?
Run the following command to test the function:
~ #
Mysql-H 10.1.1.2-u root-P
Enter password:
Error 1130 (00000): Host 'b0324-desktop. local' is not allowed to connect to this MySQL Server
The results are unexpected.
Solution: users must be assigned permissions to remote users.
Log on to the MySQL server and use the grant command to assign permissions.
Mysql> grant all on database_name. * To user_name @ '%' identified
By 'user _ password ';
Database_name, user_name, and user_password are set based on the actual situation.
After the connection is complete, use the MySQL command to connect and prompt that the connection is successful. In order to ensure the correctness, You can remotely log on and test the connection.