Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Unable to connect to the database
#5

(05-16-2021, 03:32 PM)InsiteFX Wrote: Did you try the config database settings alone to see if they work?
Also the base_url in your env.txt should have an ending backslash on it \

You can try this to see if you can connect stand alone.

PHP Code:
<?php
// Code to create the database

// Add your own username and password
$serverName "localhost";
$userName   "username";
$password   "password";

// Create the Database Connection
$connId mysqli_connect($serverName$userName$password);

// Check the Database Connection
if ($connId === false)
{
    exit("ERROR: Could not connect. " mysqli_connect_error());


// Create the Database
// Add your datya
$sql "CREATE DATABASE yourDatabaseName";

// Check that the Database was created
if (mysqli_query($connId$sql))
{
    echo "Database created successfully";
}
else
{
    echo "ERROR: Creating Database. " mysqli_error($connId);
}

// Close the Connection
mysqli_close($connId);

?>
i Change your code :


PHP Code:
<?php
// Code to create the database

// Add your own username and password
$serverName "localhost";
$userName   "xxxx";
$password   "xxxx";

// Create the Database Connection
$connId mysqli_connect($serverName$userName$password);

// Check the Database Connection
if ($connId === false)
{
    exit("ERROR: Could not connect. " mysqli_connect_error());


// Create the Database
// Add your datya
$sql "select * from xxxx.admin";

// Check that the Database was created
if (mysqli_query($connId$sql))
{
    echo "Database created successfully";
}
else
{
    echo "ERROR: Creating Database. " mysqli_error($connId);
}

// Close the Connection
mysqli_close($connId);

?>
and result is : Database created successfully 
Reply


Messages In This Thread
RE: Unable to connect to the database - by pippuccio76 - 05-16-2021, 04:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB