|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ERROR 1045: Access denied for user: 'root@localhost'
[root@localhost:3306] ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
Computer OS: Windows XP Home. PHP Version: 4.1.1 I've taken the time to read a few of the articles about this problem, but of course, I've yet to find an answer to my problem. I'll lay you out with the specific's. I'm new to PHP/MySQL, so naturally, I'm going to have a few problems. Recently, I've purchased " PHP / MySQL for dummies " book, and I've installed PhP 4.1.1 and MySQL, as well as I have MySQL admin, and MySQL-Control-Center. Regardless; My book, has numerous times told me, that root@localhost is an automatically installed account, that has no password, and all privileges, but I've yet to gain access through 'root@localhost'. Some more information; is that I use the database on my own computer, so there shouldn't be a problem with being able to fix it. I've also tried resetting the password ( My book doesn't explain how it can be done, as it assumes there are no problems. ), and been to http://dev.mysql.com/doc/mysql/en/Resetting_permissions.html and tried their instructions; now -- this is where it gets really stupid. When I type in the first line; Code:
C:\>c:\mysql\bin\mysqld-nt --skip-grant-tables I'll show you some lines out of my cmd window. Attempt # 1' Code:
C:\>c:\mysql\bin\mysqladmin -u root Reselt # 1' Code:
c:\mysql\bin\mysqladmin Ver 8.40 Distrib 4.0.21, for Win95/Win98 on i32
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Administration program for the mysqld daemon.
Usage: c:\mysql\bin\mysqladmin [OPTIONS] command command....
-c, --count=# Number of iterations to make. This works with -i
(--sleep) only
-#, --debug[=name] Output debug log. Often this is 'd:t:o,filename'
-f, --force Don't ask for confirmation on drop database; with
multiple commands, continue even if an error occurs.
-C, --compress Use compression in server/client protocol
--character-sets-dir=name
Directory where character sets are.
-?, --help Display this help and exit.
-h, --host=name Connect to host
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
-W, --pipe Use named pipes to connect to server.
-P, --port=# Port number to use for connection.
-r, --relative Show difference between current and previous values when
used with -i. Currently works only with extended-status.
-O, --set-variable=name
Change the value of a variable. Please note that this
option is deprecated; you can set variables directly with
--variable-name=value.
-s, --silent Silently exit if one can't connect to server
-S, --socket=name Socket file to use for connection.
-i, --sleep=# Execute commands again and again with a sleep between.
-u, --user=name User for login if not current user.
-v, --verbose Write more information.
-V, --version Output version information and exit
-E, --vertical Print output vertically. Is similar to --relative, but
prints output vertically.
-w, --wait[=#] Wait and retry if connection is down
--connect_timeout=#
--shutdown_timeout=#
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- -----------------------------
count 0
force FALSE
compress FALSE
character-sets-dir (No default value)
host (No default value)
port 3306
relative FALSE
socket (No default value)
sleep 0
user root
verbose FALSE
vertical FALSE
connect_timeout 43200
shutdown_timeout 3600
Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\my.cnf
The following groups are read: mysqladmin client
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit
--no-defaults Don't read default options from any options file
--defaults-file=# Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read
Where command is a one or more of: (Commands may be shortened)
create databasename Create a new database
drop databasename Delete a database and all its tables
extended-status Gives an extended status message from the server
flush-hosts Flush all cached hosts
flush-logs Flush all logs
flush-status Clear status variables
flush-tables Flush all tables
flush-threads Flush the thread cache
flush-privileges Reload grant tables (same as reload)
kill id,id,... Kill mysql threads
password new-password Change old password to new-password
ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server
Question # 1' Why in the world when I try to use the line -u root is it giving me a list of the functions, as if I typed help? Am I doing something wrong here? Or is my computer just a joke? Anyways, next attempt. In the next attempt, I decided " Well, maybe this is how it's supposed to work... So, I progressed with the steps at the resetting url. Attempt # 2' Code:
C:\>flush-privileges password "root" Result # 2' Code:
'flush-privileges' is not recognized as an internal or external command, operable program or batch file. Question # 2' What the crap? I need a cigarette, just thinking about this is stressing me out. Anyways, now that I'm all lit up, and smokey, can somebody help me? On the URL for the resetting the privileges; it says, and I quote; Quote:
Yeah, I've got a second command window, and I've typed each command there, that's on a new line, ( Maybe it's just me, but I see three lines. ) in three different commands, and every time, it doesn't work. Moving along.... I decided that this wasn't going to work for me, typing it in on three different lines, so -- I tried it this way instead; Attempt # 3' Code:
C:\>c:\mysql\bin\mysqladmin -u root flush-privileges password "newpwd" Result # 3' Code:
c:\mysql\bin\mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user: 'root@localhost' (Using password: NO)' Question # 3' Ok, so.. I'm obviously doing something wrong; can somebody please releive some of my stress here? I've been working at trying to reset this password for about 3 days now, and I've checked in my book at all the different account managing technique's, but in order to do something, you need an account with all privileges, which I obviously don't have. Somebody help me out, come on.. In the famous words of Peter Griffin; " Come on.... Come on....... " So -- yeah. Any help, or correspondance of anysort would be appreciated, even if it's not for-sure-fired ways of fixing it, even the slightest idea may help. Thank you for your time in this effort; - Oshikorosu. |
|
#2
|
|||
|
|||
|
i have tried it and got the same result as you. try
"c:\mysql\bin> mysql -u root -h localhost -p" and do not give any password press enter. i hope that i have given u the answer u required. if wrong please ignore it. this answer is for logon only. another option is "start winmysqladmin" from bin directory and edit the my.ini file. OR bin>mysqladmin -u root password 'newpassword" for setting password to change the password: bin>mysqladmin -u root -p password 'newpassword' enter password: " ur previously set password " |
|
#3
|
|||
|
|||
|
1. Yup the answer is correct, winmysqladmin.exe sets a password to the my.cnf file.
2. Uve got a php version out of date, www.php.net will give ur the latest 4.3.9 3. php and MySQL don't work in a vacuum, they need apache 4. there is an excellent app called phpmyadmin which is free at www.phpmyadmin.net which you can use to administer your MySQL server, run queries etc |
|
#4
|
|||
|
|||
|
Alright, I updated my PHP, and I tried to change the my.ini and I changed it so root was the login, and it has no password -- but now I go to this script I've made; ( I will post it in a minute. ), and now I get a few more problems, still saying that my root has not enough privileges to create databases, etc. Here's my script;
PHP Code:
And, the results; Code:
<!-- Program Name: mysql_send.php
Description: PHP program that sends an SQL query to the
MySQL server and displays the results.
-->
<html>
<head>
<title>SQL Query Sender</title>
</head>
<body>
<br />
<b>Warning</b>: mysql_connect(): Access denied for user: 'root@localhost' (Using password: NO) in <b>C:\Server\htdocs\test\MySQL_Send.php</b> on line <b>18</b><br />
Database Selected: <b>localhost</b><br>
Query: <b>CREATE DATABASE Test123</b>
<h3>Results</h3>
<hr><b>Error 1044: Access denied for user: '@localhost' to database 'Test123'</b><hr><br>
<form action=/test/MySQL_Send.php method=post>
<input type=hidden name=query value="CREATE DATABASE Test123">
<input type=hidden name=database value=localhost>
<input type=submit name="queryButton" value="New Query">
<input type=submit name="queryButton" value="Edit Query">
</form>
So, I still have no idea; I've tried your way above mentioned, phneoix , and it still tells me that root@localhost doesn't have enough privileges, and neither does '@localhost'. So, if you could please take some more time and look into the matter again, I'd be greatly appreciative. Thank you for your time in this matter, yet again, and thank you for your input already; -Oshikorosu. ----------- P.S. If you'd like to take a look at the actual script, please refer to my page; http://24.64.52.5:8000/Test/mysql_send.php. ----------- Edit: I just found out that using this PHP program, that even though I don't have the privileges to create new databases, I can still DROP DATABASE test And, that actually drops the "test" database that comes installed with MySQL. But also; I can create the same "test" database, with the following line; CREATE DATABASE test And it creates the "test" database; but here's the question yet again, same type, but now with an additive modifyer; Question; How come I can delete and create the "test" database, but not create "test123"..? Thank you, I thought I'd update you with my findings. |
|
#5
|
|||
|
|||
|
Bumped back to the top of the list; try not to be too strict about spamming, this topic's been here for a while, and bumping beats repeating the whole thread over.
-Thanks. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > ERROR 1045: Access denied for user: 'root@localhost' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|