在AWS服务器中自动更改Mysql根密码

时间:2019-02-07 13:00:25

标签: mysql amazon-ec2

我编写了一个简单的程序来检查EC2实例中AWS服务器中的mysql连接

  <?php
    $servername = "localhost";
    $username = "root";
    $password = "mypass";

    // Create connection
    $conn = new mysqli($servername, $username, $password);

    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    } 
    echo "Connected successfully";
    ?>

第一次显示Connected successfully 一段时间后,它会显示

Connection failed: Access denied for user 'root'@'localhost' (using password: YES)

再次进入终端并更改密码,然后再次重复 如何停止自动更改密码?

0 个答案:

没有答案