mysql

mysql

am 26.10.2005 12:23:09 von Zoe Brown

I am new to PHP and mysql.

I am trying to create a database with just one table. How do I setup the
username and password ?

I am trying to run a script like this

$user="username";
$password="password";
$database="database";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first
varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT
NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30)
NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2
(id))";
mysql_query($query);
mysql_close();

but am getting the error

"Warning: Access denied for user: 'username@127.0.0.1' (Using password: YES)
in c:\phpdev\www\work\budget\guava\database\create.php on line 7

Warning: MySQL Connection Failed: Access denied for user:
'username@127.0.0.1' (Using password: YES) in
c:\phpdev\www\work\budget\guava\database\create.php on line 7
Unable to select database"

Zoe

Re: mysql

am 26.10.2005 13:12:56 von Steve

> $user="username";
> $password="password";
> $database="database";

> mysql_connect(localhost,$user,$password);

I expect you meant to type "localhost" in quotes (but the error
messages imply that there's some other problem.)

What version of MySQL are you using, and on what operating system? Did
you install it, and did you follow the installation instructions on
setting up an initial account name and password?

See here for instance:


---
Steve

Re: mysql

am 27.10.2005 00:10:58 von ng

Before going further let's check the basic: Are you sure the username and
password are right ? And are you sure that this user have the rights to
connect to the database from localhost or 127.0.0.1 ?

Dae

"Zoe Brown" wrote in message
news:hOI7f.15213$65.12260@newsfe6-win.ntli.net...
>I am new to PHP and mysql.
>
> I am trying to create a database with just one table. How do I setup the
> username and password ?
>
> I am trying to run a script like this
>
> $user="username";
> $password="password";
> $database="database";
> mysql_connect(localhost,$user,$password);
> @mysql_select_db($database) or die( "Unable to select database");
> $query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first
> varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT
> NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email
> varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id
> (id),KEY id_2 (id))";
> mysql_query($query);
> mysql_close();
>
> but am getting the error
>
> "Warning: Access denied for user: 'username@127.0.0.1' (Using password:
> YES) in c:\phpdev\www\work\budget\guava\database\create.php on line 7
>
> Warning: MySQL Connection Failed: Access denied for user:
> 'username@127.0.0.1' (Using password: YES) in
> c:\phpdev\www\work\budget\guava\database\create.php on line 7
> Unable to select database"
>
> Zoe
>