linux查看已经安装的数据库

2024-06-25 13:14:27问答浏览:4222次

最新回答:可以通过以下方法解决问题:

我要提问

登录后回复

1 个回答

  • 公羊仲迎
    裔孟昕

    使用 dpkg 命令 $output = shell_exec('dpkg -l | grep database');
    $lines = explode("\n", $output);
    foreach ($lines as $line) {
    if (strpos($line, 'ii') !== false) {
    $parts = explode(' ', $line);
    $name = $parts[2];
    $version = $parts[3];
    echo "";
    }
    }
    ?>

    数据库名称
    版本
    $name$version

    使用 yum 命令 $output = shell_exec('yum list installed | grep database');
    $lines = explode("\n", $output);
    foreach ($lines as $line) {
    if (strpos($line, 'Installed') !== false) {
    $parts = explode(' ', $line);
    $name = $parts[1];
    $version = $parts[2];
    echo "";
    }
    }
    ?>

    数据库名称
    版本
    $name$version

    使用 rpm 命令

      $output = shell_exec('rpm -qa | grep database');
      $lines = explode("\n", $output);
      foreach ($lines as $line) {
      echo "
    • $line
    • ";
      }
      ?>

    赞70回复举报
我也是有底线的人~
点击加载更多

热门新闻