解决远程连接MySQL
时间:2007-06-22 来源:rac911
环境:
Server1:MYSQL1+AS4
Server2:MYSQL2+AS4
目的:
从Server1连接到Server2上的MYSQL
TNND,尝试了N遍.远程老是连接不上MYSQL,爆错如下:
[root@etc mysql]# mysql -ueagle -p
Enter password:
ERROR 1045 (28000): Access denied for user 'eagle'@'localhost' (using password: YES) 找一篇文章看一下,豁然开朗,并很快解决问题.步骤如下: Server1上配置: [root@etc etc]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> select host,user,password from user;
+---------------+-------+-------------------------------------------+
| host | user | password |
+---------------+-------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| etc | root | |
| 127.0.0.1 | root | |
| 192.168.1.162 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
| % | root | *D4CECBA84F0A507325CD8AA82FCDE04EA8BE56B0 |
+---------------+-------+-------------------------------------------+
5 rows in set (0.00 sec) mysql> grant select,update,insert,delete on *.* to [email protected] identified by "eagle";
Query OK, 0 rows affected (0.01 sec) mysql> select host,user,password from user;
+---------------+-------+-------------------------------------------+
| host | user | password |
+---------------+-------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| etc | root | |
| 127.0.0.1 | root | |
| 192.168.1.162 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
| % | root | *D4CECBA84F0A507325CD8AA82FCDE04EA8BE56B0 |
| 192.168.1.161 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
+---------------+-------+-------------------------------------------+
6 rows in set (0.00 sec) mysql> Server2上测试: [root@rman mysql]# mysql -h 192.168.1.162 -ueagle -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 60
Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> OK,问题解决!加油,MySQL菜菜鸟快入门了,,,
Enter password:
ERROR 1045 (28000): Access denied for user 'eagle'@'localhost' (using password: YES) 找一篇文章看一下,豁然开朗,并很快解决问题.步骤如下: Server1上配置: [root@etc etc]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> select host,user,password from user;
+---------------+-------+-------------------------------------------+
| host | user | password |
+---------------+-------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| etc | root | |
| 127.0.0.1 | root | |
| 192.168.1.162 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
| % | root | *D4CECBA84F0A507325CD8AA82FCDE04EA8BE56B0 |
+---------------+-------+-------------------------------------------+
5 rows in set (0.00 sec) mysql> grant select,update,insert,delete on *.* to [email protected] identified by "eagle";
Query OK, 0 rows affected (0.01 sec) mysql> select host,user,password from user;
+---------------+-------+-------------------------------------------+
| host | user | password |
+---------------+-------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| etc | root | |
| 127.0.0.1 | root | |
| 192.168.1.162 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
| % | root | *D4CECBA84F0A507325CD8AA82FCDE04EA8BE56B0 |
| 192.168.1.161 | eagle | *A405AB5000F1FB26DD3D3EB259A6E424169B2AEB |
+---------------+-------+-------------------------------------------+
6 rows in set (0.00 sec) mysql> Server2上测试: [root@rman mysql]# mysql -h 192.168.1.162 -ueagle -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 60
Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> OK,问题解决!加油,MySQL菜菜鸟快入门了,,,
相关阅读 更多 +