不允许在 php 中连接到这个 MariaDB 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43124641/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
not allowed to connect to this MariaDB server in php
提问by Yashvantsinh Zala
I try connect my remote server database in php but it's give bellow error
我尝试在 php 中连接我的远程服务器数据库,但它给出了以下错误
Host 'xx.xxx.xx.xx' is not allowed to connect to this MariaDB server in
Host 'xx.xxx.xx.xx' is not allowed to connect to this MariaDB server in
My connection code like this
我的连接代码是这样的
$servername = "my_server_address";
$username = "my_username";
$password = "my_password";
$dbname = "my_db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
回答by Daniel
If your credentials are valid, you most likely need to configure MariaDB for remote client access.
如果您的凭据有效,您很可能需要为远程客户端访问配置 MariaDB。
回答by Oliver E.
I had a similar issue after installing "xampp-windows-x64-7.3.6". After looking around and testing several solutions without any changes I did the following:
安装“xampp-windows-x64-7.3.6”后我遇到了类似的问题。在环顾四周并在没有任何更改的情况下测试了几种解决方案之后,我执行了以下操作:
- Uninstall xampp
- Restart machine
- Reinstall xampp
- Restart machine
- Importing old databases via phpmyadmin
- 卸载 xampp
- 重启机器
- 重新安装 xampp
- 重启机器
- 通过 phpmyadmin 导入旧数据库
All works fine for me now.
现在一切对我来说都很好。
I did initially add a new user account. That might have caused the problem but I'm not testing this again.
我最初确实添加了一个新用户帐户。这可能导致了问题,但我不会再次测试。