Access Denied

Why I am not able to create database using php

It shows:-
Could not create database: Access denied for user 'user'@'192.168.0.%' to database 'TUTORIALS'

You cannot create databases with PHP. You can only create databases through your control panel.

With MySQL, generally only the root user can create databases. We can’t give your database user the permission to manage the databases because that would allow you to delete the databases of other people. And I don’t think you would like your databases to be deleted by someone else by accident either.

That’s why only InfinityFree has root access and can create databases. We expose limited access to create databases through the control panel.

So, you can grant permission for create and not for delete.

@NamarsahaM_Document_Manager said:
So, you can grant permission for create and not for delete.

While you could maybe get CREATE permissions (not sure if MySQL actually allows non root users to have those permissions), you would not be able to access the database because you don’t have any permissions on said database. To get that, your user would also need to have access to the GRANT statement. However, with that statement you could give yourself control over anything on the database server. So again: it’s not possible.

Why do you need to create databases from your script in the first place?

I want to create database through php to reduce time by getting login and creating database.