Php 同一台机器上的Web服务器和MySQL服务器”;错误:(28000/1045)用户访问被拒绝;
首先介绍一些细节:: 在Ubuntu 14.10 LTS上运行MySQL 5.6,Apache作为Web服务器。 服务器位于路由器后面,所以端口80和3306被转发并正常。 网络服务器运行良好 MySQL用户列表:Php 同一台机器上的Web服务器和MySQL服务器”;错误:(28000/1045)用户访问被拒绝;,php,mysql,apache,Php,Mysql,Apache,首先介绍一些细节:: 在Ubuntu 14.10 LTS上运行MySQL 5.6,Apache作为Web服务器。 服务器位于路由器后面,所以端口80和3306被转发并正常。 网络服务器运行良好 MySQL用户列表: mysql> select user, host from mysql.user; +------------------+-------------------+ | user | host | +--------------
mysql> select user, host from mysql.user;
+------------------+-------------------+
| user | host |
+------------------+-------------------+
| userA | % |
| root | 127.0.0.1 |
| debian-sys-maint | localhost |
| phpmyadmin | localhost |
| root | localhost |
| userA | localhost |
| root | elite81 |
+------------------+-------------------+
my.cnf文件:
`[客户]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
`
问题::
只有“root”可以访问MySQL数据库。。我希望使用“userA”进行访问,但得到以下错误代码:
A)当php代码中的主机值为:服务器的外部IP地址时
Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'userA'@'router.asus.com' (using password: YES)
B)当主机值为:127.0.0.1时
Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'userA'@'localhost' (using password: YES)
更正此错误的尝试失败:
哈希绑定地址/
将绑定地址更改为192.168.1.87(本地ip地址)/
已将绑定地址更改为外部IP地址/
还在网络中尝试连接-不工作/
还做了同花顺特权;在MySQL中
浏览了网上的几个相关帖子,但没有解决!:-(
我需要帮助
还有,我有一个问题。
当Web服务器与MySQL服务器在同一台机器上运行时,php连接文件中的主机应该是什么?已解决:
刷新权限;
刷新权限;
附加信息:我可以在机器上连接为
mysql-u userA-p-hlocalhost
,但不能连接为mysql-u userA-p-h11.11.11
DroppeduserA@%
检查:未工作附加信息:我可以在机器上连接为mysql-u userA-p-hlocalhost
,但不能连接为mysql-u userA-p-h11.11.11
DroppeduserA@%
检查:未工作