Can I create database using php code for free hosted/domain plans. (Hostinger).
If so what to write in $db_name
$db_name = "profile";
OR $db_name = " cpannel username_profile";
For CREATE DATABASE $db_name
I tried but it get connected. At the time creating database it says access denied.
Could not create database: Access denied for user 'user'@'192.168.0.%' to database 'TUTORIALS'
from the error message, it looks like your user 'user' doesn't have privileges to create tables. have you granted him privileges to do that?
you didn't mention a database, but to grant most privileges to a user, you could do it like this in mysql:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX ON *.* TO 'user'@'%'
hope this helps.
If you are using free domains, they will not allow you to create the database with PHP
as giving permission for that may result in deletion/addition of databases from other users too. For reference visit: https://forum.infinityfree.net/discussion/2158/access-denied#latest an answer by an admin of one of the free database provider!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.