Jump to content

Archived

This topic is now archived and is closed to further replies.

RogerRAZ

MySQL and PHP communicating

Recommended Posts

I cannot get MySQL and PHP to communicate and therefore I cannot create a simple query. I was getting the Fatal error message "call to undefined function mySQL_connect() in C:\...", but after I recently downloaded and installed a new version of Apache or maybe MySQL that error disappeared. Before downloading the new version of Apache or MySQL, when I ran the PHPInfo script I could not see an area of information regarding MySQL, but now I do. Now when I run the query, I receive the die message "couldn't connect to server" that I have entered in the script. I have enabled so many extensions and tried so many other things, I just don't know what to try next. Any suggestions? Thanks!

Roger

Share this post


Link to post
Share on other sites
Probably the MySQL server is not running, or is misconfigured.

If you don't want to deal with this level of maintenance, you can use a ready-made "LAMP-like" package, like EasyPHP or UniformServer:

[a href=\"http://www.uniformserver.com/\" target=\"_blank\"]http://www.uniformserver.com/[/a]
[a href=\"http://www.easyphp.org/\" target=\"_blank\"]http://www.easyphp.org/[/a]

Share this post


Link to post
Share on other sites
Look at my thread here:
[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87276\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=87276[/a]

All what you need to do is enable the mysql extension which requires you to edit two lines within the php.ini nothing too complicated

Share this post


Link to post
Share on other sites
wildteen, MySQL is actually enabled [based on what I see].

If you try to do something like:
mysql_connect(...) or die(mysql_error()) it may tell you what is wrong.

Share this post


Link to post
Share on other sites
[!--quoteo(post=379434:date=Jun 2 2006, 02:17 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 2 2006, 02:17 PM) [snapback]379434[/snapback][/div][div class=\'quotemain\'][!--quotec--]
wildteen, MySQL is actually enabled [based on what I see].

If you try to do something like:
mysql_connect(...) or die(mysql_error()) it may tell you what is wrong.
[/quote]



poirot:

The error message I receive is the following:
"Access denied for user 'Roger'@'localhost' (using password: YES)"

Note: One other thing I changed is the PHP.ini file is the following:
extension_dir="c:/php/ext" it was extension_dir="c:\php\ext" I has seen this both ways.

What do I do? Thanks!

Share this post


Link to post
Share on other sites
Probably because "Roger" has no privileges or maybe there's not even a user called "Roger".

You must Grant privileges to this user "Roger".
[a href=\"http://dev.mysql.com/doc/refman/5.0/en/grant.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/grant.html[/a]

Share this post


Link to post
Share on other sites
[!--quoteo(post=379447:date=Jun 2 2006, 03:26 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 2 2006, 03:26 PM) [snapback]379447[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Probably because "Roger" has no privileges or maybe there's not even a user called "Roger".

You must Grant privileges to this user "Roger".
[a href=\"http://dev.mysql.com/doc/refman/5.0/en/grant.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/grant.html[/a]
[/quote]


Well, I/We finally got everything to work. It is amazing how there are so many different ways people have written in books and stated about what files should go where and what needs to be enabled.

Although I granted privileges to myself I had the host name set to, now don't laugh to hard, "My Computer" as oppose to localhost. I created a new User and set it up the correct way and now everything works fine. Thanks!!!!!!!!!!!!!!!!!!

Roger
[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Share this post


Link to post
Share on other sites
[!--quoteo(post=379434:date=Jun 2 2006, 07:17 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 2 2006, 07:17 PM) [snapback]379434[/snapback][/div][div class=\'quotemain\'][!--quotec--]
wildteen, MySQL is actually enabled [based on what I see].

If you try to do something like:
mysql_connect(...) or die(mysql_error()) it may tell you what is wrong.
[/quote]Not with PHP5 isn't. As you have to enable the mysql extension in the php.ini file in order for PHP5 to use the mysql library of functions.

But any way I misread the orginal post.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.