Databases :: MySql :: mysql_connect() |
|||
| By: DiZzY |
Date: 12/10/2004 00:00:00 |
Points: 20 | Status: Answered Quality : Excellent |
|
Ok, I have my database setup, and it is called lotr_3. I'm going to make up some information here so I don't give out my real user name and password. The website this database will be on is <A HREF="http://lotr3.co.uk">http://lotr3.co.uk</A>. Say the datase administrator name is john and the password is doe. Would I be right if the mysql_connect() statement looked like this: mysql_connect(lotr3.co.uk, "john", "doe"); ? I tried this and it gives me this error message: Warning: Access denied for user: 'john@p15112340.pureserver.info' (Using password: YES) in /home/virtual/site12/fst/var/www/html/dbase.php3 on line 16. What is wrong with my connect statement? |
|||
| By: DiZzY | Date: 12/10/2004 12:39:00 | Type : Comment |
|
| Oh yea, if you need the php information it is at <A HREF="http://lotr3.co.uk/phpinfo.php">http://lotr3.co.uk/phpinfo.php</A> . |
|||
| By: carchitect | Date: 12/10/2004 17:18:00 | Type : Comment |
|
| ok write this mysql_connect("localhost","username","password"); replace username and password with your... or tru this |
|||
| By: VGR | Date: 13/10/2004 07:03:00 | Type : Answer |
|
| mysql_connect(lotr3.co.uk, "john", "doe"); may-be the missing quotes around the hostname ? :D |
|||
| By: dravenPT | Date: 13/10/2004 21:03:00 | Type : Comment |
|
| First of all, it is better to use the IP address on the mysql_connect, and not the hostname. Like: mysql_connect("194.65.79.190", "john", "doe") If the database and your php files are on the same machine, so it's even better to use "localhost" mysql_connect("localhost", "john", "doe") If it still doesn't work, then you need to check in your mysql database server if the user john is created and has permissions to connect, select, create, etc. You can test your mysql user account: If the machine with the mysql client is the same with the server, you can try connecting to the mysql server with a mysql client GUI ( <A HREF="http://www.mysql.com/downloads/gui-mysqlgui.html">http://www.mysql.com/downloads/gui-mysqlgui.html</A> ) . Then you'll be able to locate your problem: if it is on your mysql_connect, or if it is on your database server permissions. Remember that this works if you have the client and the server on the same machine. If not, probably it won't work because your client IP need to be allowed to connect to the server. Sorry about my english, it's a bit rusty... :o) Good Luck, DrAVeN |
|||
| By: Ice_S5 | Date: 13/10/2004 21:54:00 | Type : Comment |
|
| <b>Warning: Access denied for user: 'john@p15112340.pureserver.info' (Using password: YES) </b> This says that you haven't rights to access this database using TCP connection from p15112340.pureserver.info (the same IP as lotr3.co.uk). I see two ways of resolving this situation: 1) Try mysql_connect("", "john", "doe") AFAIK it uses /var/sock connection to database instead of TCP. Maybe your admin granted you such access. 2) Your admin has to type: GRANT ALL PRIVILEGES ON lotr3.* to john@p15112340.pureserver.info IDENTIFIED BY 'doe'; Then you can use your old way of connecting to DB. |
|||
| By: balalayka | Date: 14/10/2004 07:39:00 | Type : Comment |
|
| try this mysql_connect("localhost", "root") or mysql_connect("lotr3.co.uk", "root") |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








