无法使用phpMyAdmin访问mysql服务器
我最近安装了最新版本的WAMP,但在访问MySQL(MariaDB)服务器时遇到问题。我可以通过MariaDB控制台访问服务器。因此,我确信密码和用户名是正确的,并且服务器正在运行无法使用phpMyAdmin访问mysql服务器,php,mariadb,wamp,Php,Mariadb,Wamp,我最近安装了最新版本的WAMP,但在访问MySQL(MariaDB)服务器时遇到问题。我可以通过MariaDB控制台访问服务器。因此,我确信密码和用户名是正确的,并且服务器正在运行 WAMP: 3.2.2 Apache: 2.4.41 PHP: 7.4.0 MariaDB: 10.4.10 phpMyAdmin: 5.0.2 当我使用phpMyAdmin网页访问时: 我还尝试使用一个简单的测试脚本访问: <?php $servername = "localhost"
WAMP: 3.2.2
Apache: 2.4.41
PHP: 7.4.0
MariaDB: 10.4.10
phpMyAdmin: 5.0.2
当我使用phpMyAdmin网页访问时:
我还尝试使用一个简单的测试脚本访问:
<?php
$servername = "localhost";
$username = "root";
$password = "";
try {
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
?>
密码已更改,我已更新测试脚本$password=“MyNewPass”代码>,仍然是相同的结果
WAMP,右键单击,工具->测试端口3306。也给出了预期的结果:
***** Test which uses port 3306 *****
===== Tested by command netstat filtered on port 3306 =====
Test for TCP
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
任何帮助都将不胜感激。似乎您应该从wamp工具配置phpMyAdmin,并且您应该从本地ip地址使用ipconfig
控制台输入php脚本,而不是使用php脚本。这可能是某种保护,比如SELinux阻止您的Apache访问数据库吗?编辑:似乎您在Windows上尝试将地址更改为127.0.0.1/testConnection.php
?有时我会遇到localhost
被解析为ipv6格式::1
,然后pma无法解释它并导致错误。我尝试过,得到了相同的错误我尝试更改为本地ip地址,得到了相同的结果。由于某些原因,apache无法连接到mysql服务器
***** Test which uses port 3306 *****
===== Tested by command netstat filtered on port 3306 =====
Test for TCP
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 3306 is used by a processus with PID = 8660
The processus of PID 8660 is 'mysqld.exe' Session: Services
The service of PID 8660 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct