premecorp — 2012-06-18T07:49:03-04:00 — #1
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.
rubble — 2012-06-18T07:52:29-04:00 — #2
The host tends to be localhost if your code is on the same server as your code.
premecorp — 2012-06-18T08:02:27-04:00 — #3
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.
rubble — 2012-06-18T10:39:28-04:00 — #4
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.
premecorp — 2012-06-18T10:45:15-04:00 — #5
I have that one also & now also I am getting same error.
cpradio — 2012-06-18T10:52:24-04:00 — #6
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.
premecorp — 2012-06-18T10:56:05-04:00 — #7
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
cpradio — 2012-06-18T11:25:45-04:00 — #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.
premecorp — 2012-06-19T05:02:57-04:00 — #9
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';
cpradio — 2012-06-19T07:13:36-04:00 — #10
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.
premecorp — 2012-06-19T09:52:17-04:00 — #11
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");
cpradio — 2012-06-19T14:57:25-04:00 — #12
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).
premecorp — 2012-06-20T03:57:52-04:00 — #13
Can u tell what are the step for this & where I have to do this?
cpradio — 2012-06-20T07:11:21-04:00 — #14
I would try contacting your host, the steps are going to vary greatly to what I do at mine.