您似乎处于 AWS 内的托管环境中,您无权访问 root 或查看表上的授权,但这可能对其他人有帮助并显示几个步骤。
首先,如果我进入 sqlyog(或 toad 或 mysql 工作台)并尝试连接到 AWS mysql,我会收到以下错误:
http://img836.imageshack.us/img836/4594/out1.GIF
所以问题是 root@pool-72-93-207-216.bstnma.fios.verizon.net
所以我以root身份进入mysql(是的,我知道你可能无法做到这一点!)..
我执行以下操作
mysql> use test;
mysql> grant all privileges on test.* to 'root'@'pool-72-93-207-216.bstnma.fios.verizon.net' identified by 'mypassword123z';
mysql> select user,host from mysql.user;
+------------------+--------------------------------------------+
| user | host |
+------------------+--------------------------------------------+
| foo_user | % |
| root | 127.0.0.1 |
| foo_user | 72.93.207.216 |
| foo_user2 | 72.93.207.216 |
| root | ::1 |
| | domU-12-31-38-04-B2-89 |
| root | domU-12-31-38-04-B2-89 |
| | localhost |
| debian-sys-maint | localhost |
| phpmyadmin | localhost |
| root | localhost |
| root | pool-72-93-207-216.bstnma.fios.verizon.net |
+------------------+--------------------------------------------+
mysql> SHOW GRANTS FOR 'root'@'localhost';
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*4F4504C8CA8D22648E58B5092F653457698A9EBE' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
mysql> show grants for 'root'@'pool-72-93-207-216.bstnma.fios.verizon.net';
+----------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@pool-72-93-207-216.bstnma.fios.verizon.net |
+----------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'@'pool-72-93-207-216.bstnma.fios.verizon.net' IDENTIFIED BY PASSWORD '*CACE4BB4D0A5D265BA7FCBEED600DC8976884A43' |
| GRANT ALL PRIVILEGES ON `test`.* TO 'root'@'pool-72-93-207-216.bstnma.fios.verizon.net' |
+----------------------------------------------------------------------------------------------------------------------------------------------+
然后我回到 sqlyog(或 toad 或 mysql 工作台)并使用 root 和密码 mypassword123z 登录,然后我就进入了。
此外,您可以通过端口 22 和您的 AWS pem 文件创建一个安全的 SSH 代理隧道,使用类似 Putty。