Can't create SQL database with PHP

Username (e.g. epiz_XXX) or Website URL

http://yourdatabase.ga

(please specify the website or account you are asking about)

Error Message

ERROR: Could not able to execute CREATE DATABASE CREATETHEDATABASE. Access denied for user ‘MY USERNAME’@‘192.168.%’ to database ‘CREATETHEDATABASE’

(please share the FULL error message you see)

Other Information

I am trying to create a PHP system that create’s a SQL database, but when I try what I made, I get the error above. The code what I use:

                `$geterror = 0;
                $link = mysqli_connect("sql309.epizy.com", "MY USERNAME", "MY PASSWORD");

                if($link === false){
                    die("ERROR: Could not connect. " . mysqli_connect_error());
                    $geterror = 1;
                }

                $sql = "CREATE DATABASE ".$databasename;
                if(mysqli_query($link, $sql)){
                    echo "Database created successfully";
                } else{
                    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
                    $geterror = 1;
                }`

(other information and details relevant to your question)

Of course you cannot create database through PHP, nor we allow that, you can only do that through Cpanel->Mysql databases.

10 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.