Trying to create a login-system, but the browser just shows the error message (Access denied for user 'root'@'localhost'). I have confirmed the password for mysql, but realized that the password to get into the server is needed, but not provided.
Part of my php-file looks like this:
<?php
session_start(); //Nevermind this indent
$DATABASE_HOST = 'localhost';
$DATABASE_USER = 'root';
$DATABASE_PASS = ''; //redacted, but provided
$DATABASE_NAME = 'users';
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME);
if ( mysqli_connect_errno() ) {
exit('Failed to connect to MySQL: ' . mysqli_connect_error()); // it always catches here
}
It contains the mysqli_connect() with all the variables to the database, but not to get into the mysql server. I'm using php 8.0 with mariaDB on Ubuntu server 20.04. How can I provide the password, grant the access to or else to get into the mariaDB-server? I would like to keep the password if possible. And yeah, I'm a beginner.