+ 3
Can you create MySql databases using php on a local server.
I've tried and for the life of me i cant get it to work. I cant remember off the top of my head but my code is something like $sql = "CREATE DATABASE MyDatabase"; It never works. I have to go into MyPhpAdmin and create them that way.
4 Answers
+ 11
Use localhost and try.
Search on Youtube, how to run sql query on localhost using XAMPP
+ 7
yes,. but you should install and configure MySQL also.
+ 2
Your code should work, syntax is right. Maybe you forgot to set up user restrictions for your php connection if you do not use root user or you do not execute query from PHP properly.
0
try this and tell me the result:
$sql="CREAT DATABASE IF NOT EXISTS MyDatabase";