Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-03-2009, 01:01 PM Database connect
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
Well, I've decided I would start seriously learning PHP. I've decided to mess with some pre-made scripts to get a feeling of how to build my own. My goal is to build a very simple CMS which will basically only have functions for adding new articles and editing them.

Right now I am building a login script which is copied exactly from this tutorial http://www.evolt.org/php_login_scrip...ber_me_feature

I'm running everything from my local machine on a xampp server. This is what I have in the database.php file

PHP Code:
<?

/**
 * Connect to the mysql database.
 */
$conn mysql_connect("localhost""akon""aKon") or die(mysql_error());
mysql_select_db('akon'$conn) or die(mysql_error());

?>
On the main.php page it comes up with the error Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'akon'@'localhost' (using password: YES) in C:\xampp\htdocs\konetcms\database.php on line 6
Access denied for user 'akon'@'localhost' (using password: YES)

I've checked the passwords and everything is correct. I'm not sure why I've got this error and I've tried searching google for an answer with no help.

If you could tell me why I'm getting this it would be great.

Thanks
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-06-2009, 02:53 AM Re: Database connect
Average Talker

Posts: 26
Name: Prithwiraj Bose
Location: Kalyani, West Bengal, India
Trades: 0
At first stop using XAMPP server. This is the worst one, I've ever used with thousands of bugs. Try using Apache2Triad, which is also open source server.

And you password is not given correctly. I guess. Because xampp doesn't accept 4 digit passwords. Please recheck.

Two possible reasons for the error are:
1. You password is incorrect for the username.
2. The MySQL server is not running (because of the buggy xampp server) and thus no localhost database server is there. Check the list of processes from Task Manager. If mysqld.exe is not running there, be sure, MySQL server is not running.
__________________

Please login or register to view this content. Registration is FREE
in Kolkata
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
| Become a
Please login or register to view this content. Registration is FREE
for Free.
techbongo is offline
Reply With Quote
View Public Profile
 
Old 07-06-2009, 04:52 PM Re: Database connect
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
Sorry, actually I got it running. Since it is on my local machine there is no password for the mysql databases. The correct code is

PHP Code:
 <?

/**
 * Connect to the mysql database.
 */
$conn mysql_connect("localhost""root") or die(mysql_error());
mysql_select_db('akon'$conn) or die(mysql_error());

?>
Thanks though for your help. So far I haven't had problems with the server. Do you know of any major bugs I'd have to watch out for?


</span> </span>
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
Old 07-06-2009, 08:12 PM Re: Database connect
Defies a Status

Posts: 1,605
Trades: 0
I have experienced no problems with xampp.

You should consider adding a password for root and mysql if you leave it running all the time. That will break some of the "goodies" they include in the distribution until you modify the config files.

You will also need to change your file for this script to include the password if you create one.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 07-07-2009, 04:01 PM Re: Database connect
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
For some reason you can't add a password to root with xampp. I tried creating one and you couldn't log into the phpmyadmin, so I had to re-install the entire server. Does anybody know how to get around this?

Thanks
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
Old 07-07-2009, 05:27 PM Re: Database connect
Defies a Status

Posts: 1,605
Trades: 0
Are you using Vista or XP?

Did you create a new folder for each site you want to play with?

If I try to browse to localhost a password is required. If I go to localhost/sitefolder none is required.

All I did was follow the security reccomendations that came with the distribution.

I have a password on localhost and for mysql.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 07-07-2009, 06:50 PM Re: Database connect
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
I'm using vista.

Yeah, I do have a folder for each site I'm working with, but when I go to http://localhost no password is required.

When I installed it I used the istaller and it didn't prompt me to enter a password or anything, but since it is an apache server, I could create a htaccess file that would protect certain folders, right?
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Database connect
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.52875 seconds with 12 queries