Jump to content

mySQL?


Asday

Recommended Posts

<?php

$sqlCon=mysql_connect("localhost", "asday", "***");
if (!$sqlCon)
{
die("Fark! " . mysql_error());
}
else
{
mysql_query("CREATE DATABASE people");
}
?>

 

outputs:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'asday'@'localhost' (using password: YES) in C:\xampp\htdocs\SQL\index.php on line 3
Fark! Access denied for user 'asday'@'localhost' (using password: YES)

 

What's wrong?

Link to comment
Share on other sites

1. Have you created a user and set a password for it?

2. Have you got the correct username and/or password?

3. Are the permissions set?

4. If you installed WAMP go into cPanel which gives you access to phpMyAdmin. From there you can check everything via a GUI which will make everything a lot easier.

Link to comment
Share on other sites

1. Have you created a user and set a password for it?

2. Have you got the correct username and/or password?

3. Are the permissions set?

4. If you installed WAMP go into cPanel which gives you access to phpMyAdmin. From there you can check everything via a GUI which will make everything a lot easier.

 

1)  Yes

2)  Yes

3)  Don't know

4)  Didn't install WAMP

 

(Going home now, so no PC)

Link to comment
Share on other sites

By default, the mysql root password is empty.

 

To check this out, open the command prompt and do the following:

 

cd c:\path\to\mysql\bin

mysql -u root

 

If this logs you in, then you need to do the following

GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

 

Also, make sure to update the root password:

 

UPDATE mysql.user SET password = PASSWORD('new_pass') where mysql.user = 'root';

 

Good luck

Link to comment
Share on other sites

By default, the mysql root password is empty.

 

To check this out, open the command prompt and do the following:

 

cd c:\path\to\mysql\bin

mysql -u root

 

If this logs you in, then you need to do the following

GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

 

Also, make sure to update the root password:

 

UPDATE mysql.user SET password = PASSWORD('new_pass') where mysql.user = 'root';

 

Good luck

 

Would that be Linux or windoze command prompt?

Link to comment
Share on other sites

If you're running Linux, mysql should be in the PATH by default.

 

so in that case, it would just be

mysql -u root

 

In windows, if not apart of the PATH, you must open a command prompt at c:\program files\mysql server 5.0\bin (or equivalent) and run the same command

mysql -u root

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.