Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,780 members, 7,817,235 topics. Date: Saturday, 04 May 2024 at 08:31 AM

Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost (6724 Views)

How To Remove Localhost From My Site ? / Help, My Xampp Is Not Showing My Projects On Localhost / Import Excel Sheet To Mysql Database (2) (3) (4)

(1) (Reply) (Go Down)

Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by smartsoft(m): 6:17pm On Jun 18, 2007
Hello guys i'm having problem with MYSQL on my local machine, i tried to connect to mysql from command line it returns this error back
"cannot connect to mysql, Access denied for root@localhost" But i can connect to MySQLAdmin,PHPMyAdmin don't know what went wrong.
have tried to see what the problem is but still tells me i can't connect i reset the root password from MySQLAdmin, still got the same error message. Anyhelp i will be greatfull. lest i forget i use MySQL5.0.1.1
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by boraddo(m): 8:44pm On Jun 18, 2007
meehn, dat thing don suffer me many times, but u can use this code to solve it


SELECT Host, User, Password FROM mysql.user
WHERE LENGTH(Password) > 16;

UPDATE mysql.user SET Password = OLD_PASSWORD('password')
WHERE Host = 'localhost' AND User = 'root';
FLUSH PRIVILEGES;


obviously, ur new password shld be "password" after u run d script,

let me knw if it works, safe
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by canachy(m): 8:56am On Jun 19, 2007
Go to your MySQL command Line Client and run this code:

CONNECT mysql;

UPDATE user SET Password = OLD_PASSWORD('type your desired password here')
WHERE host = 'localhost' AND user = 'root';


To confirm the effect, run this code:

SELECT password from user where host='localhost' AND user='root';

NOTE: you can as well change the hostname and username using the same method.

I hope this helps.
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by smartsoft(m): 7:58pm On Jun 19, 2007
Thank you guys, well i have done that before posting this topic here it all the same the problem is not the code to reset the passsword, the problem is  when i open DOs environment, if i try typing Mysql and press the enter button, it will display that error for me,  but if i open my MysqlAdmin. or go to PHPMyAdmin i can go in freely and do whatever i want to do.

what i can't do is type Mysql on my command line.
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by Cactus(m): 9:48pm On Jun 19, 2007
if u r logged on as root

UPDATE user SET Password=PASSWORD('typeinnewpasswordhere') WHERE User='root';
FLUSH PRIVILEGES;
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by canachy(m): 11:33am On Jun 20, 2007
smartsoft:

the problem is when i open DOs environment, if i try typing Mysql and press the enter button, it will display that error for me, but if i open my MysqlAdmin. or go to PHPMyAdmin i can go in freely and do whatever i want to do.

what i can't do is type Mysql on my command line.

Smartsoft, I now understand your plight.

Don't just type only mysql in your (DOS) command prompt; since it doesn't let you login as annonymous.

Try this (still in the DOS environment):

mysql -u root -p (then hit ENTER)

the '-p' is to let you enter your password; the next line will do just that, then type your password and hit ENTER.

I beleive this will work, if it doesn't, I advice that you always use the "MySQL Comand Line Client"

Please let us know if this works. SUCCESS!!!
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by smartsoft(m): 8:19pm On Jun 20, 2007
bros men, this Mysql is a pain in my ass. i enter mysql -u root -p and hit my enter button still gives me the same error

Access Denied for users root@localhost (using password : Yes )
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by Cactus(m): 3:23am On Jun 21, 2007
If it is not working and you intend on working on a windows platform i suggest you get WAMP @ http://www.wampserver.com/en/

that gives you a full package install of apache2.2, php5, mysql5 (i think) then you can then go into the httpd, php.ini to do your manual configuration as required.

smartsoft:

bros men, this Mysql is a pain in my ass. i enter mysql -u root -p and hit my enter button still gives me the same error

Access Denied for users root@localhost (using password : Yes )



your mistake: mysql -u root -p and hit my enter


you should write : mysql -u root -p typeinyourpasswordhere

and hit enter

you forgot to type in your password lol. gl

-u = username = root
-p = password = yourpassword
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by canachy(m): 10:37am On Jun 21, 2007
smartsoft:

bros men, this Mysql is a pain in my ass. i enter mysql -u root -p and hit my enter button still gives me the same error

Access Denied for users root@localhost (using password : Yes )


Please try and do that again, it will definitely ask for your password: make sure you enter the password correctly. Keep Cracking
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by smartsoft(m): 8:14pm On Jun 21, 2007
Have tried that my brother same thing i wish i could have the print screen here and see where i type in my password.

When i hit the enter button, it prompt me for password which i entered and still same thing.

Well it seems it depend on the kinda webserver i'm using. cos i'm using APACHE2TRIAD
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by canachy(m): 8:42am On Jun 22, 2007
@Smartsoft

I don't think it has anything to do with your web server: MySQL is a database server; and should run effectively (if properly installed) on your local system even if no web server is installed.

Have you tried accessing your databases through the MySQL Comand Line Client, if no, try using it and let see what happens.
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by smartsoft(m): 8:16pm On Jun 22, 2007
Yah it working as root access
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by Cactus(m): 1:16am On Jun 23, 2007
You can as well try it using the Query browser which is the gui for mysql db or if u have phpmyadm setup up.

another option is to create a new user and granting full privilege just like the root access.
Re: Mysql: Cannot Connect To Mysql, Access Denied For Root@localhost by my2cents(m): 5:22pm On Jun 24, 2007
So,

There r 2 ways to work: working hard and working smart. I have used both the DOS prompt and phpadmin. To me, the latter is easier and smarter in my opinion. Y not just go with phpadmin and get what you want to do done in seconds as opposed to spending posting time upon posting time scratching your head to get it done via DOS prompt?

That's my take anyways. Then again, I am known to be a very lazy person wink

Good luck to you, regardless of the approach you take.

(1) (Reply)

7 Characteristics Of A Successfull Blog - Mediapace / How To Translate A Scanned Jpeg Document Into English: Urgent Help Pls! / How Do You Receive Your Money From Flippa?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 26
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.