Remote SQL?

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
New php-forum User
New php-forum User
Posts: 10
Joined: Tue Mar 04, 2003 6:46 pm
Location: Singapore

Fri Jun 06, 2003 4:38 am

I have a question.

I'm able to connect and access to by database if I used mysql_connect("localhost") but I cannot access my database if I put mysql_connect("") instead. (Assuming that was my IP.

The error i got was:

Access denied for user: '@' to database 'db1'

I wanna know how I can configure my MySQL settings so that I can (1)define a username and password - I'm new to MySQL.
(2) Restrict/Allow access to MySQL server by IP. The user and password thing is more important. Please help. Thanks.
<?php ASP2PHP() in progress ?>

php-forum Active User
php-forum Active User
Posts: 264
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Fri Jun 06, 2003 4:48 am

to create a user and grant rights:

GRANT ALL ON databasename.* TO username IDENTIFIED BY 'password'

you can change ALL to other things such as SELECT which would allow the user to only run SELECT statements on the tables.

you can also specify a table name instead of * after the . By doing so the user will only be able to access that table in that database.

question 2

GRANT ALL ON databasename.* TO username@localhost

GRANT ALL ON databasename.* TO

GRANT ALL ON databasename.* TO 'username'@'64.230.%'

hope that helps

User avatar
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Fri Jun 06, 2003 7:12 am

or you seat before router where MySQL port closed....
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";

Post Reply