Saltar al contenido

cómo conectar la base de datos mysql con el ejemplo de código phpmyadmin

Ejemplo 1: phpMyAdmin intentó conectarse al servidor MySQL.

/* Answer to: "phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server." */

/*
  Go to c:wampappsphpmyadmin3.3.9. Then open/edit the file named:
  config.inc.php

  And in the following line, enter the password that you have setup
  previously:
  $cfg['Servers'][$i]['password'] = '';
  > If your password is "123":
  > $cfg['Servers'][$i]['password'] = '123';

  This should work, if not change this:
  from: $cfg['Servers'][$i]['AllowNoPassword'] = true;
  to: $cfg['Servers'][$i]['AllowNoPassword'] = false;
*/

Ejemplo 2: conexión mysql phpmyadmin

<?php
  // This is for checking if your file is linked in your page or game or whatever
  echo "IT WORKS"; // My File is successfuly Linked

  //Remember to create a Database in phpmyadmin or any Online Database
  // the values passed in this parameters are:  the host, the user, user password and the database Name
  $con = mysqli_connect('localhost', 'root', 'root', 'unityaccess');

  // check that connection happen
  if(mysqli_connect_errno()) {
    echo "1: Connection Failed"; //error code #1 = connection Failed
    exit();
  }
?>
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *