php远程连接服务器报错。
<br /> $host = '远程服务器ip';<br /> $root = '用户名';<br /> $pwd = '密码'; <br /><br /> $con = @mysql_connect($host,$root,$pwd);<br /><br /> mysql_query("set names 'utf8'");<br /> @mysql_select_db("XS_CQC", $con) or die(mysql_error());<br />
我连接本地的数据库是正常,但是连接远程的话报这个错误。
<br />Access denied for user 'ODBC'@'localhost' (using password: NO)<br />
这个是什么意思?
------解决思路----------------------远程连接 MySQL,需要对方授权
------解决思路----------------------链接远程数据库的帐号要有远程链接的权限
在数据库中执行
> GRANT ALL PRIVILEGES ON 数据库名称.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
> FLUSH PRIVILEGES;
这样就可以了
------解决思路----------------------没有链接权限,
在对方的mysql 数据库中需要什么访问权限。
在phpmyadmin中设置user,host
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn