SitePoint Sponsor |
|
User Tag List
Results 1 to 15 of 15
Thread: Access denied MySql
-
May 3, 2004, 07:36 #1
Access denied MySql
I have downloaded a pre-configured PHP/MYSql/Apache package for Windows, and everything works well. Can start MySql server and can perform all the queries etc. PHP works well with Apache too. However cannot access MySql from PHP scripts.Get access denied for username@localhost password (YES)etc. Have tried re-setting password etc but no luck. Pretty sure it's a password thing.
One set of instructions said to write a certain script to bin directory. How do you write to a directory when you can't acces any of the files?
Can anyone tell me where and how to re-set password so I can access MySql from PHP.
Can't wait!!
Glenn
-
May 3, 2004, 08:09 #2
- Join Date
- Sep 2001
- Location
- Panama
- Posts
- 2,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes, the problem is with your password. You need to create a root user.
Try the following (you can skip the first step if you have already started MySQL service) :
Code:Click Start −> Run and type cmd in the box, click Ok. This will open a console window (or MS−Dos box). In the console window enter the following commands and check that you receive the correct response: Enter: cd c:\mysql\bin Enter: mysqld−max−nt −−install Response: Service successfully installed. Enter: net start MySql Console should say: The MySql service is starting. Console should say: The MySql service was started successfully. Congratulations you have installed MySQL; however, before we are done here we are going to make MySQL more secure, by adding a password, so only you can change the databases. At the console window type the following commands (replace new_password with your new password): Enter: cd c:\mysql\bin Enter: mysql −u root mysql Response: Welcome to the MySQL monitor ..... Enter: UPDATE user SET Password=PASSWORD('new_password') Enter: WHERE user='root'; Response: OK... Enter: FLUSH PRIVILEGES; Response: OK... Enter: DELETE FROM user WHERE user=''; Response: OK... Enter: DELETE FROM user WHERE Host='%'; Response: OK... Enter: DELETE FROM user WHERE User=''; Response: OK... Enter: DELETE FROM db WHERE Host='%'; Response: OK... Enter: exit Response: Bye Enter: exit Response: Console window closes.
Community Guidelines | Community FAQ
"He that is kind is free, though he is a slave;
he that is evil is a slave, though he be a king." - St. Augustine
-
May 3, 2004, 09:15 #3
Access Denied
Thanks for your input.
Tried proceedure as suggested...no luck. Still same error message
???
Glenn
-
May 3, 2004, 09:31 #4
- Join Date
- Sep 2001
- Location
- Panama
- Posts
- 2,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Did you get any errors while executing those steps? And if you didn't, did you try connecting with the root user after you set up the account?
PHP Code:$db = mysql_connect("localhost", "root", "rootpassword") or die('I cannot connect to the database because: ' . mysql_error());
Community Guidelines | Community FAQ
"He that is kind is free, though he is a slave;
he that is evil is a slave, though he be a king." - St. Augustine
-
May 3, 2004, 09:45 #5
Access Denied
Thanks.
There were no error messages during the steps. Did try to connect afterwards with no success.
Cannot seem to get back to the config settings in MySql. I may have selected a username other than 'root' during initial set-up, but can't seem to get back to that window.
-
May 3, 2004, 10:02 #6
- Join Date
- Sep 2001
- Location
- Panama
- Posts
- 2,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by gpaul
Community Guidelines | Community FAQ
"He that is kind is free, though he is a slave;
he that is evil is a slave, though he be a king." - St. Augustine
-
May 3, 2004, 11:07 #7
-
May 3, 2004, 12:50 #8
Access Denied
Somewhere during first setup, I chose a new username and password. I went into sqlmyadmin, and changed it back to "root" plus my 'new password' in the 'my.ini' file. That is how it remains in there.
When I tried the proceedure you suggested, I couldn't make it work using the DOS box. I went directly to MySql monitor which was running and chose USE mysql; and made the changes in the 'mysql' database. Perhaps that was not the right thing to do. I couldn't execute the UPDATE commands etc. without first choosing a database.
I'm trying to connect from PHP script:
<?php
mysql_connect("localhost","root","my password");
?>
I'm sure it's a simple thing...just not sure what.
Thanks
-
May 3, 2004, 13:54 #9
- Join Date
- Sep 2001
- Location
- Panama
- Posts
- 2,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I wouldn't know how to do it using that method.
If you can't find a way to make it work, I suggest you uninstall MySQL and reinstall it, and then follow the steps I provided in my first post. Don't do anything through the MySQL GUI until you have set up everything in DOS.Community Guidelines | Community FAQ
"He that is kind is free, though he is a slave;
he that is evil is a slave, though he be a king." - St. Augustine
-
May 6, 2004, 08:58 #10
- Join Date
- Feb 2003
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I got the same problem , after I read very careffully, It resolved my problem, thank you Toly
, just one note I wrote - instead of |
ex:
mysqld|max|nt ||install
mysql |u root mysql
should be
mysqld−max−nt −−install
mysql −u root mysql
-
May 6, 2004, 09:21 #11
- Join Date
- Sep 2001
- Location
- Panama
- Posts
- 2,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm glad it worked out for you.
Originally Posted by gonzakad
Community Guidelines | Community FAQ
"He that is kind is free, though he is a slave;
he that is evil is a slave, though he be a king." - St. Augustine
-
May 7, 2004, 10:58 #12
- Join Date
- Feb 2003
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you right
, I saw that like || using internet explorer 6 but in netscape 7 looks normal , maybe the problems is the browser , for example IE 6 can't see the smilies but in Netscape yes I can, I don't know who or what is wrong with the browser
I need to get more ifomation about it.
-
Dec 27, 2004, 22:40 #13
- Join Date
- Jul 2003
- Location
- Corner seat
- Posts
- 1,069
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Toly
"I cannot connect to the database because: Client does not support authentication protocol requested by server; consider upgrading MySQL client"
Quite honestly, I have no clue what is going here. What are possible causes for this error?
-
Jan 1, 2005, 23:50 #14
- Join Date
- Jan 2003
- Posts
- 5,748
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What OS are you using btw? Your best bet is to download the latest version of 4 and reinstall it again
When you uninstall the current version you have, remember to delete the mysql* folder, usually installed under 'Program Files > MySql Server 4.1 > ...'
Do not try to create your username/password via the configuration process, but as suggested via DOS. What I did was to completely delete the entire contents and just insert a new user altogether, rather than doing an update - I only have the one row in the users table.
-
Jan 2, 2005, 00:06 #15
- Join Date
- Jul 2003
- Location
- Corner seat
- Posts
- 1,069
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, it turns out that password needs to be hashed in the old way; more specifically, I needed to use the command old_password to create password. I'm still confused a little, but I kind of decided to move on, as I can do what I need to do for the time being.
Bookmarks