Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Me aparece en mi pagina este mensaje
Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'ROOT'@'localhost' (using password: YES) in C:\AppServ\www\Curso Web\06AplicacionCRUD\conexion.php on line 8
Error al conectar: Access denied for user 'ROOT'@'localhost' (using password: YES)


Y voy a mi línea de código y esta esto
función  conexionMySQL ()
{	
	$ conexion  =  new  mysqli ( SERVIDOR , USUARIO , PASO , DB );
	if ( $ conexion -> connect_error )
	{
		/ *
		$ error = "<div class = 'error'>";
			$ error. = "Error de Conexión N ° ". $ conexion-> connect_errno. " Mensaje del error: <mark>". $ conexion-> connect_error. "</mark>";
		$ error. = "</div>";
		morir ($ error)		
		* /
		
		$ error  . =  " <div class = 'error'> Error de Conexión N ° % d  Mensaje del error: <mark>%s</mark> </div> " ;
		printf ( $ error , $ conexion -> connect_errno , $ conexion -> connect_error );
	}

Ayuda por favor

What I have tried:

function conexionMySQL()
{	
	$mysqli=new mysqli(localhost,ROOT,DBpepejuarez89,DBNAME);
if (mysqli_connect_errno()) {
die("Error al conectar: ".mysqli_connect_error());

Y nada
Posted
Updated 26-Jul-19 8:20am
v2
Comments
Richard MacCutchan 27-Jul-19 4:24am    
The username "ROOT", or the password "YES", are not valid. Check your database settings. But you should never use the root password in any application.

1 solution

PHP
$mysql = conexionMySQL();

One can only assume that the variable $mysql does not receive any value. Use your debugger to find out why.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900