一些详细信息::在以Apache为with服务器的Ubuntu14.10LTS上运行MySQL 5.6。服务器位于路由器的后面,因此端口80和3306被转发并确定。网络服务器运行正常。
MySQL用户列表:
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`
问题:只有“根”才能访问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中。
在网上浏览了几个相关的帖子,但没有解决!:-(需要帮助。
还有,我有个问题。当when服务器与MySQL服务器在同一台机器上运行时,php连接文件中的主机应该是什么?
发布于 2015-12-14 23:38:51
已解决:
FLUSH PRIVILEGES;。https://stackoverflow.com/questions/34249824
复制相似问题