I have setup a basic table and connected a PHP file with the database. I can fetch data from the database by using SELECT
. However, when I try to use UPDATE
or INSERT INTO
, I get the message:
"INSERT command denied to user ''@'localhost' for table 'table_data'".
When I try to use the query in PMA, i am able to insert data. But when i want to adjust user rights, it says i don't have the rights to do so. But when i use the SQL SHOW GRANTS, i receive:
"Grants for xxx@10.0.% GRANT USAGE ON . TO 'xxxl'@'10.0.%' IDENTIFIED BY PASSWORD GRANT ALL PRIVILEGES ON 'database_name'.* TO 'xxx'@'10.0.%' WITH GRANT OPTION.
I am using the only MySQL account provided by my host so I assume it is the root user.
$servername = "mysql.domain_name.nl";
$username = 'xxx';
$password = 'xxx';
$conn = new mysqli($servername, $username, $password);`
$username = $_POST['username'];
$password = $_POST['password'];
$query = "INSERT INTO 'game'.'login_data' ('username', 'password') VALUES ('".$username."', '".$password."')";
$data = mysql_query ($query)or die(mysql_error());
Please help me to gain rights to be able to INSERT
.