Hi all
I am attempting to install LAMP on Ubuntu 22.04
Apache/2.4.52
PHP Version 8.1.2-1ubuntu2.11
Mysql Ver 8.0.32-0ubuntu0.22.04.2 for Linux on x86_64
Apache and PHP running. I can log into Mysql from a CLI
When I try to run Mysql from PHP though it returns:
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' in /home/nick/Desktop/sites/db_test.php:13 Stack trace: #0 /home/nick/Desktop/sites/db_test.php(13): mysqli_connect() #1 {main} thrown in /home/nick/Desktop/sites/db_test.php on line 13
Any clues?
More information:
.................................................. ..........
This is the code :
$servername = "localhost";
$username = "root";
$password = "test";
$dbname = "gm_numbers";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
....
This is the PHPINFO bit about mysql
mysqli
MysqlI Support enabled Client API library version mysqlnd 8.1.2-1ubuntu2.11 Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0
Bookmarks