dsztc99732 2018-01-19 09:45
浏览 53

无法使用PHP和MySQL连接到phpMyAdmin [重复]

This question already has an answer here:

I am trying to connect database using PHP and Apache2 server but it could not connect. I am providing my code below.

<?php
session_start();

$_SESSION['start'] = time();
$_SESSION['show_session_alert'] = 1;

$VIEW_ADMIN = 1;
$VIEW_OWNER = 2;

$con = mysql_connect("localhost", "root", "abcdefg");
mysql_select_db('easyride', $con);

$connect = mysqli_connect("localhost", "root", "abcdefg", "easyride");
?>

I am trying to connect to MySQL database but it could not connected. I am giving below the phpMyAdmin configuration file.

/etc/phpmyadmin/config-db.php:

$dbuser='phpmyadmin';
$dbpass='abcdefg';
$basepath='';
$dbname='phpmyadmin';
$dbserver='';
$dbport='';
$dbtype='mysql';

Here I am unable to connect getting the error localhost is currently unable to handle this request: HTTP ERROR 500. I need to connect to my MySQL database.

</div>
  • 写回答

1条回答 默认 最新

  • dongliang1893 2018-01-19 09:54
    关注

    It is likely that you are using some version of php7, in this case the functions mysql_connect and mysql_select_db no longer exists in php7 so they will not work

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算