Question:
MySQL help: 'Access denied' error?
Doug
2007-04-16 16:07:49 UTC
I'm running a Windows PC and having problems with MySQL.

Whenever I issue commands in the mysql.exe DOS box, it says:

ERROR 1044: Access denied for user: '@localhost' to database 'mysql'

I know that there is a command that would eliminate this problem, but I don't know where to type it (it obviously isn't in the DOS box)

It's:

$ mysql -u root -p

Where do I put this command? Perhaps in the my.ini file? Do I have to restart my server after putting it in?

Help is appreciated, even if all you can over is a link for my answer.

Thanks
Four answers:
michellen
2007-04-17 07:05:20 UTC
This problem is usually a result of attempting to access your server without specifying a valid username and password.



Solution:



To set passwords for both the ROOT 'MySQL user' and the ADMINISTRATIVE 'MySQL user', you will need to UPDATE the 'mysql' database, which contains user privileges.

To connect to the 'mysql' database through the MySQL monitor program, follow these steps:



1-Log into your Freedom server.



2-Enter the following command at your shell prompt:



> mysql -u root mysql



The mysql> prompt appears, indicating that you are now working within the MySQL monitor:

mysql>



Now that you are connected to the 'mysql' database, you can set the password for both the 'root' user and the administrative user according to the instructions in the following sections.



Setting the root MySQL Password

for further information visit

http://support.interland.com/freedom/faq/mysql_error_denied.htm



***Also try opening a console, log in as root with su, then just typing mysql (without the -u parameter)

http://www.linuxquestions.org/questions/showthread.php?t=225782



***Or try:

Admin user id: root

Default password: blank

The first task is to assign a password:



Note: the following SQL commands will also work:



mysql> USE mysql;

mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';

mysql> FLUSH PRIVILEGES;



and then



mysql -h localhost -u root -ppassword

http://www.linuxquestions.org/questions/showthread.php?t=183280



***Or try this:

1) stop the mysql server

2) mysqld_safe --skip-grant-tables

3) mysql -u root

4) mysql> SHOW GRANTS FOR root;

5) GRANT ALL ON *.* TO 'root'@'%';

6) restart the server (without --skip-grant-table option) and try to login

http://www.mysqltalk.org/view-next-topic-vt142367.html?view=next



~~~~~~~~where can u type the commands~~~~~~

c:\mysql\bin>mysql -u root

http://www.netikus.net/documents/MySQLServerInstallation/index.html?setupsecurity.htm



I've a very poor idea abt this, but I hope it helps.
.PANiC
2007-04-16 16:12:01 UTC
I would recommend looking through your MySQL configuration files. Also, you need a USER to connect to the database. The default user is "root" with no password.
anonymous
2007-04-16 16:27:00 UTC
Possible problem #1-You're trying to connect to your website's database from localhost? Contact your hosting provider and ask them how to change your database permissions so that you can access it locally.



Possible problem #2-Make sure that you have the correct username, host, and password information.
roubekas
2016-11-25 04:29:43 UTC
nicely there is an argument on your script with how your connecting to the database, because of the fact it feels like the database has no account for unn_s006202 so which you may choose to verify the account record on your account. or the guy who runs the mysql information superhighway hosting.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...