我在执行命令时遇到问题
grant select, insert, delete, update on dbname.* to username identified by 'password';
从远程连接到我的服务器。它的响应是
ERROR 1044 (42000): Access denied for user 'root'@'xxx.xxx.x.xx1' to database 'dbname'。
我的服务器的地址是xxx.xxx.x.xx1,我的远程机器的地址是xxx.xxx.x.xx2。
我从远程机器使用以下命令登录到MySQL服务器
sudo mysql -h xxx.xxx.x.xx1 -u root -p
当我从我的远程连接运行命令select current_user()时,它返回root@'xxx.xxx.x.xx1'。它不应该返回root@xxx.xxx.x.xx2'吗
我为root@'xxx.xxx.x.xx1和root@'xxx.xxx.x.xx2'添加了所有权限。
当我为我的远程连接的ip地址授予root访问权限时,为什么我不能从我的远程机器执行该命令?当从远程机器登录时,select current_user()应该返回我的远程机器的ip地址还是我的服务器的ip地址?
发布于 2012-12-27 19:31:51
解决了这个问题。
首先,我将/etc/mysql/my.cnf中的绑定地址行从127.0.0.1更改为我的服务器地址。
其次,我以root身份登录到我的服务器上本地的mysql,并使用以下命令创建了另一个用户:
grant select, insert, update, delete on databasename.* to newuser@my_remote_desktop_address identified by 'password';
然后,我可以以新用户的身份登录到我的桌面上的mysql并执行我的命令。
https://stackoverflow.com/questions/14026151
复制相似问题