|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Strange MySQL Access Problem
First some basic info:
OS: Windows XP Server: Microsoft-IIS/5.1 PHP: 4.3.2 MySQL: 4.0.13 Problem: I can work with MySQL via the command line just fine. (I can create databases, select info, etc.) However, whenever I try to open a connection with it in PHP, I always get the following error: "Access denied for user: 'root@127.0.0.1' (Using password: YES)" Here's the connection string: PHP Code:
I do have the same username/password combo entered in the "my.ini" file. Here's the "my.ini" file: (MySQL was installed in default directory) --------------------------------------------------- #This File was made using the WinMySQLAdmin 1.4 Tool #8/16/2003 12:52:20 PM #Uncomment or Add only the keys that you know how works. #Read the MySQL Manual for instructions [mysqld] basedir=C:/mysql #bind-address=169.254.101.152 datadir=C:/mysql/data #language=C:/mysql/share/your language directory #slow query log#= #tmpdir#= #port=3306 #set-variable=key_buffer=16M [WinMySQLadmin] Server=C:/mysql/bin/mysqld-nt.exe user=root password=password --------------------------------------------------- So, what's the problem?!? Also, when I try to use the MySQL Control Center I get the same error. {[localhost] ERROR 1045: Access denied for user: 'root@127.0.0.1' (Using password: YES)} Would somebody PLEASE help me? I've spent hours serching the manuals, Google, etc. THANKS! Last edited by pentapenguin : August 16th, 2003 at 11:00 PM. |
|
#2
|
|||
|
|||
|
So, you are planning to use IIS as your web server?
Did you configure IIS properly to run php scripts? Yor codes are absolutely error free. However, you can also check the correctness of your script in the following way. 1. CD to PHP folder >php.exe YourScript.php |
|
#3
|
|||
|
|||
|
Thanks for replying.
Yes, PHP is working fine. I have tons of other pages and "phpinfo.php" as well -- all work great! Like I said, MySQL works just fine through the command line *only.* No PHP support. I didn't know about running PHP directly from the command line though.... |
|
#4
|
|||
|
|||
|
Lets have you log into mysql from the command line, switch to the 'mysql' database, and issue the following command:
select host,user from user; Also, please post the command (exactly as you would type it) you use on the command line to access mysql.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#5
|
|||
|
|||
|
I'm pretty much a beginner at MySQL, but have you added the user to the database..or is that what laidbak just told you?
|
|
#6
|
|||
|
|||
|
------------------------------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Jeremy>cd c:\mysql\bin C:\mysql\bin>mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 to server version: 4.0.13-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> USE mysql; Database changed mysql> SELECT host,user FROM user; +-----------+------+ | host | user | +-----------+------+ | % | | | % | root | | localhost | | | localhost | root | +-----------+------+ 4 rows in set (0.05 sec) mysql> ------------------------------------------------------------------------------------ The two users were already in the table when I set MySQL up. Let me know what you think. |
|
#7
|
|||
|
|||
|
| % | |
| % | root | | localhost | | | localhost | root | +-----------+------+ Ok, where is what you need to do... login as root... right now you are logging in anonymously. mysql -u root -p |
|
#8
|
|||
|
|||
|
Thanks for replying.
Unfortuantly, it didn't work. Here's what happened. ------------------------------------------------------------------------------------ Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Jeremy>cd c:\mysql\bin C:\mysql\bin>mysql -u root -p Enter password: ******** ERROR 1045: Access denied for user: 'root@127.0.0.1' (Using password: YES) C:\mysql\bin> ------------------------------------------------------------------------------------ I did type the password correctly (actually did it twice), and I still get that "1045" error. Some other thing I tried: (All of my scripts worked fine on another XP machine with a little older version of MySQL.) I uninstalled the current version of MySQL and put the same version that worked on the other machine on. That didn't work either. Does anyone think that there's a problem with my new machine? |
|
#9
|
|||
|
|||
|
Plz try following, it may take 5-10 minutes
01. Keep a backup of your databases from folder c:\mysql\data 02. Shutdown the database (NET STOP MYSQL) 03. Uninstall MySQL 04. Manually delete C:\MySQL folder 05. Re-install MySQL and copy your database back to c:\mysql\data folder After above steps you have a user root with nopassword. This will work and you can save your time. Do you have MySQL Front? If you need it, please let me know, I can give you a copy (its a free software). Thanks |
|
#10
|
|||
|
|||
|
Hi.
I don't have MySQL Front, so a link would be appreciated. I tried the EXACT steps you said, but I can't access MySQL (on the command line) until I run the "winmysqladmin.exe" program in the C:\mysql\bin" directory. I'm propmted to enter a username and password. Once I do that, I can access MySQL on the command line. (I guess it sets up the "my.ini" file.) As for there's no password, look at the "user" table info I posted above. Evough though it isn't working yet, THANKS GUYS! |
|
#11
|
|||
|
|||
|
Probabbly MySQL didnt run as service, thats why you had to force it by WinMysQLAdmin.exe.
Let me know your email, I will send one to u (coz' MySQL Font is no longer in Bussiness) and they have no web site now too. |
|
#12
|
|||
|
|||
|
My email is jeremy_conley@hotmail.com
Thanks |
|
#13
|
|||
|
|||
|
1. You need to first shut down mysql
2. You need to restart mysql without the grant tables ( use this command line switch : --skip-grant-tables ) 3. Now when you login with the command : "mysql -u root -p" you should have no problem. 4. Now that you are in, change the root password 5. Delete all user accounts with a blank password DELETE FROM user WHERE password=''; 6. issue command : flush-privileges 7. Logout, then login with your new root password. |
|
#14
|
|||||||||
|
|||||||||
|
Hi.
Just to make sure I'm with you (and don't mess anything else up further), I'll use the following commands: Quote:
("NET STOP MySQL" and then "mysqld --remove" ?) Quote:
("mysql --skip-grant-tables" or something else?) Quote:
(OK) Quote:
("UPDATE user SET password='password' WHERE user='root' OR use "mysqladmin -u root password 'password' "?) Quote:
(OK) Quote:
("mysqladmin flush-privileges" ?) Quote:
("exit" then "mysql" ?) |
|
#15
|
|||
|
|||
|
Quote:
|
|
#16
|
|||
|
|||
|
Quote:
|