Page 1 of 1
Question from a new learner of mysql
Posted: Tue May 25, 2004 10:38 pm
by artfhc
I am learning php and mySQL right now by myself, but the problem is that I cannot access the "mySQL" database when I commend this:
it shows up something like this:
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
So I tried to use php to testify the connection between mySQL and the server. And it comes out to be fine.
Code: Select all
<?
$connection = mysql_connect("localhost", "root", "") or
die("Sorry - unable to connect to mySQL");
echo("Congraduations - u connected to mySQL.");
?>
The output is:
Congraduations - u connected to mySQL.
So what should I do?
Start learning php
Posted: Wed May 26, 2004 1:49 am
by Lord Sauron
What you should do?
To be honest. I would start reading a php tutorial instead of directly trying to edit some code. Your code doesn't make any sense at all.
Off course the output is 'congratulations' if you are giving the command "echo("Congraduations - u connected to mySQL.");"
And what are trying to do with "use mysql"? Use is no sql command, and neither is mysql.
Posted: Wed May 26, 2004 9:00 pm
by artfhc
Maybe I didn't explain it clearly. The code below is what I did in the mySQL window.
Code: Select all
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.03 sec)
mysql> use mysql
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
Thankyou for ur advice, but I actually looked up the "use" keyword from a tutoral book. Maybe I misunderstand how the code works. Please help me.
Posted: Wed May 26, 2004 9:06 pm
by Joe
try use test; to see what happens
Posted: Wed May 26, 2004 9:31 pm
by artfhc
works. But I need mysql, because "test" is useless.
Re: Start learning php
Posted: Wed May 26, 2004 10:04 pm
by d3ad1ysp0rk
Lord Sauron wrote:What you should do?
To be honest. I would start reading a php tutorial instead of directly trying to edit some code. Your code doesn't make any sense at all.
Off course the output is 'congratulations' if you are giving the command "echo("Congraduations - u connected to mySQL.");"
And what are trying to do with "use mysql"? Use is no sql command, and neither is mysql.
You can type commands into the mysql command prompt interface.. ya..