Please help:
I am trying to create a mysql database within a php script without any success.
I have a Linux operating system with an apache web server and a mysql database server
all on the same machine.I can create a database within the linux-mysql console but when I try to create the database by php programming is not possible.There is a
connection with the database server.
There is no message of error, simply the program can t process the query
“create database if not exists gestion”.
The program is the following:
<?php
error_reporting(E_ALL|E_STRICT);
ini_set(‘display_errors’,true);
$conn=@mysql_connect(“localhost”,”eduardo”,”diaz”);
If ($conn){
echo “Connect”;
}else{
echo “There is no connection”;
}
$consult=”CREATE DATABASE IF NOT EXISTS gestion”;
$res=mysql_query($consult,$conn);
If ($res){
echo “Success”;
}else{
echo “Faillure”;
}
?>
How can I grant all privileges to a database with php programming?
I am trying the following command without any success:
$consul=”grant all on * to eduardo identified by ‘diaz’ with grant option”;
$res=mysql_query($consul,$conn);
I wrote the grant command in the linux console with success.
I have a problem with a query.
Moderator: General Moderators
Re: I have a problem with a query.
Make sure the user you are connecting with through PHP has permissions to issue a GRANT statement. Probably the user you are running with from the shell has root privileges.