Forum Moderators: mack
I used this to create my database
mysql> CREATE DATABASE first_test;
Query OK, 1 row affected (0.31 sec)
mysql> USE first_test;
Database changed
mysql> CREATE TABLE people (
id int UNIQUE NOT NULL,
first_name varchar(40),
surname varchar(50),
PRIMARY KEY(id)
);
Query OK, 0 rows affected (0.24 sec)
mysql> INSERT INTO people VALUES(1,'Ann','Brache');
Query OK, 1 row affected (0.09 sec)
mysql> INSERT INTO people VALUES(2,'Narcizo','Levy');
Query OK, 1 row affected (0.02 sec)
mysql> INSERT INTO people VALUES(3,'Tony','Crocker');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM people;
+----+------------+---------+
¦ id ¦ first_name ¦ surname ¦
+----+------------+---------+
¦ 1 ¦ Ann ¦ Brache ¦
¦ 2 ¦ Narcizo ¦ Levy ¦
¦ 3 ¦ Tony ¦ Crocker ¦
+----+------------+---------+
3 rows in set (0.19 sec)
And
GRANT ALL ON first_test.* TO pee_wee@localhost IDENTIFIED BY 'let_me_in'
All of this worked fine but when I tried the following
<?php
$username = "pee_wee";
$password = "let_me_in";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
// you're going to do lots more here soon
mysql_close($dbh);
?>
I got the message Unable to connect to MySQL.
I did this by using the book Beginning PHP 5 and MySQL from novice to professional and lots of online documentation and I don't know what else to do but I hope someone can help me out.
Thanks
Have a look at this recent thread regarding MySQL 4.1.7 problems [webmasterworld.com].