Current location: Hot Scripts Forums » Other Discussions » Database » PHP not recognizing admin in MySQL


PHP not recognizing admin in MySQL

Reply
  #1 (permalink)  
Old 04-15-07, 07:28 PM
gizelle gizelle is offline
Newbie Coder
 
Join Date: Feb 2007
Location: Wisconsin
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP not recognizing admin in MySQL

I'm new to both PHP and MySQL. I have set up MySQL and my databases show up, I can do queries from MySQL. Things are fine.

Now I am trying to create and access MySQL databases using PHP. Unfortunately they always start out with defining a 'user' and 'password'. As I am the administrator (on my home computer), when I go into MySQL Monitor, it immediately asks for my password. There is no area to differentiate there are different user accounts. It assumes I am the administrator.

When setting up MySQL, it never asked for a name, just a password. I tried setting up another user account with password and Granted full privileges to all databases. However when I put in that name and password, nothing happens. I don't even get the error messages I programmed in (if I did it right.).

I'm not looking for homework help. I'm just wondering if I installed something wrong or left out a step with MySQL and now the PHP is not acknowleging.

Anyway, here is my code:
PHP Code:

$DBConnect=@mysqli_connect("localhost""user name""password")

    Or die(
"<p>Unable to connect to the database server.</p>" "<p>Error code " mysqli_connect_errno() . ":" mysqli_connect_error()) . "</p>";
    
$DBNAME="hit_counter";
if (!@
mysqli_select_db($DBConnect$DBName) ) {
    
$SQLstring="CREATE DATABASE $DBName";
    
$QueryResult=@mysqli_query($DBConnect$SQLstring)
        Or die(
"<p>Unable to execute the query.</p>" 
        
"<p>Error Code " mysqli_errno($DBConnect)
        . 
":" mysqli_error($DBConnect) ) . "</p>";
        
mysqli_select_db($DBConnect$DBName);
    }
$TableName="count";
$SQLstring="SELECT * FROM $TableName";
$QueryResult=@mysqli_query($DBConnect$SQLstring);
if (!
$QueryResult) {
    
$SQLstring="CREATE TABLE $TableName (countID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY)";
    
$QueryResult=@mysqli_query($DBConnect$SQLstring)
        Or die(
"<p>Unable to create the table.</p>"
        
."<p>Error code " mysqli_errno($DBConnect)
        . 
":" mysqli_error($DBConnect) ) . "</p>";
}
$SQLstring="INSERT INTO $TableName VALUES (NULL)";
$QueryResult=$mysqli_query($DBConnect$SQLstring)
    Or die(
"<p>Unable to exeucte the query.</p>"
    
."<p>Error code " mysqli_errno($DBConnect)
    . 
":" mysqli_error($DBConnect) ) . "</p>";
$Hits=mysqli_insert_id($DBConnect);
echo 
"<h1>There have been $Hits hits to this page!</h1>";
mysqli_close($DBConnect); 
I tried substituting 'root' as the user with my password, but that didn't work either.

I'm working on Windows XP, and it did have mssql already on it. I went into msconfig and unchecked the box for it under 'services' thinking it may be trying to run along with MySQL.

Too new to know if one has anything to do with the other.

Gizelle
Reply With Quote
  #2 (permalink)  
Old 04-15-07, 07:32 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Topic moved to Database.
Reply With Quote
  #3 (permalink)  
Old 04-15-07, 08:29 PM
gizelle gizelle is offline
Newbie Coder
 
Join Date: Feb 2007
Location: Wisconsin
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy PM you?

Sorry, I don't understand what I did or what you are talking about. I thought I was posting to the forum.

Gizelle
Reply With Quote
  #4 (permalink)  
Old 04-15-07, 08:39 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You posted this in the PHP section, but I find it more appropriate in the Database section. So I moved it. No big deal...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
installing PHP and MySQL on 32 computers dkc1657 Web Servers 5 01-31-07 10:41 PM
WEB HOSTING - $4.99/MONTH For 1GB HD & 25GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 10-20-05 07:26 AM
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 07-14-05 10:56 AM
Complex mysql sorting pb (Get cat_list from cids &pcids with 1 query, willing to pay) aqw PHP 1 06-23-05 07:02 PM
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 10-30-04 01:19 PM


All times are GMT -5. The time now is 04:57 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.