Remote SQL?

Codes here !

Moderators: macek, egami, gesf

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

Remote SQL?

Postby eddy05 » 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("203.125.125.203") instead. (Assuming that was my IP.

The error i got was:

Access denied for user: '@203.125.125.203' 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.

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

Postby liquedus » 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 username@someurl.com

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

hope that helps

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Remote SQL?

Postby WiZARD » Fri Jun 06, 2003 7:12 am

or you seat before router where MySQL port closed....


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests

cron