I have created an user in phpmyadmin in hosting server & when I upload & trying to open that page I am getting this warning.
Warning: mysql_connect() [function.mysql-connect]: Host 'xxxxxxxxxx.com' is not allowed to connect to this MySQL server in /home/xxxxxx/xxxxxx/config.php on line 7
It is working in my local system bt nt working in hosting server. If anyone have any idea kindly help me to short out this issue.
The host tends to be localhost if your code is on the same server as your code.
I have tried this also i got this error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'xxxxx'@'localhost' (using password: YES) in /home/xxxxxxxx/xxxxxx/config.php on line 7
If i remove the password, i got
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'xxxxx'@'localhost' (using password: NO) in /home/xxxxxxxx/xxxxxx/config.php on line 7
Its not in my local system, its a hosting server so here i think i have to give host name as server.
I belive you only need to give the host name if connecting to another server. I only ever use localhost on the servers I use.
Have you changed the passwords in your connection code to the same as the user you setup? On some setups the username will be prefixed with the usrename of the server along with the database names.
So if your password was world and your server login was hello then your password would be hello_world.
I have that one also & now also I am getting same error.
Have you tried asking your hosting provider? Or checked their online documentation/wiki? I know for the host I use, I have to setup the mysql domain name, then grant a mysql user access on that domain.
I have added this code
GRANT ALL PRIVILEGES ON database_name*.* TO user_name @"%" IDENTIFIED BY "password";
then I am getting this error
Parse error: syntax error, unexpected T_STRING in /home/xxxxxxx/xxxxxx/xxxxx.php on line 8
That is a step in the right direction. As now it seems you have a syntax error in your PHP file on line 8. Check that your string has the correct opening and closing quotes, a semi-colon, etc.
I am getting this error, in this code everything is looking correct, I am nt able to find the error, pls help me to solve this issue.
Parse error: syntax error, unexpected T_STRING
GRANT ALL PRIVILEGES ON database.* TO 'user' @'%' IDENTIFIED BY 'password';
We need to see the first 10 lines of the file /home/xxxxxxx/xxxxxx/xxxxx.php
It is hard to tell you what to fix without seeing the php syntax.
This is the complete database connection code & I got the error
Parse error: syntax error, unexpected T_STRING in /xxxxxx/xxxxx/xxxxxxx/xxxxxx.php on line 8
$mysql_hostname = "xxxxxxxx";
$mysql_user = "xxxxxxxxx";
$mysql_password = "xxxxxxxxxx";
$mysql_database = "xxxxxxxxx";
grant all privileges on $mysql_database.* to $mysql_user@'%' identified by $mysql_password;
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("There is some thing wrong in database connection");
mysql_select_db($mysql_database, $bd) or die("Some thing went wrong");
Unfortunately, you can't grant the privileges that way. You need to run that through phpMyAdmin or directly connected to the mysql server via SSH.
Otherwise, you would need to be able to connect to mysql to run the query (of which you are unable to do at this point in time).
Can u tell what are the step for this & where I have to do this?
I would try contacting your host, the steps are going to vary greatly to what I do at mine.
This topic is now closed. New replies are no longer allowed.