Koozali.org: home of the SME Server

Mysql db error

Offline dede77b

  • **
  • 29
  • +0/-0
Mysql db error
« on: October 07, 2008, 05:18:55 PM »
Hi guys, I spent 2 days on this forum looking for my problem, and trying many suggestion but I still have my problem

This is my error, seen many many time on this forum. Sorry for that but I can't solve my error alone.

#1045 - Access denied for user 'root'@'localhost' (using password: YES)
(myphpadmin error)

I pretty sure that my default root password for mysql is right, I followed the suggestion to reset default password as describe here
http://wiki.contribs.org/MySQL#Resetting_the_MySQL_root_password

but still have problem.

All the contribs I installed can't access mysql. Joomla is in error, myphpadmin give me that error, cpg gallery too.

Could be that the default password of mysql is right, and the problem is the user and password I used for creating db for these application i mentioned before?

Please, give me suggestion for that.

Thanx Fred

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Mysql db error
« Reply #1 on: October 07, 2008, 06:53:03 PM »
Hi guys, I spent 2 days on this forum looking for my problem, and trying many suggestion but I still have my problem

This is my error, seen many many time on this forum. Sorry for that but I can't solve my error alone.

#1045 - Access denied for user 'root'@'localhost' (using password: YES)
(myphpadmin error)

I pretty sure that my default root password for mysql is right, I followed the suggestion to reset default password as describe here
http://wiki.contribs.org/MySQL#Resetting_the_MySQL_root_password

but still have problem.

All the contribs I installed can't access mysql. Joomla is in error, myphpadmin give me that error, cpg gallery too.

Could be that the default password of mysql is right, and the problem is the user and password I used for creating db for these application i mentioned before?

Please, give me suggestion for that.

Thanx Fred
You should have looked at the FAQ. Never use the root password for your applications, it is a far to powerfull account for applications. The mysql root password is a random string of about 70 charachters which you do not need to know.

You can login on the SME Server shell as root, without a password, as there is a clever mechanism providing the password when you try to login. This does not work when you login from other locations or clients.

Create a user with the proper privileges for the task it should do like layed out here: http://wiki.contribs.org/SME_Server:Documentation:FAQ#MySQL_Database
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline dede77b

  • **
  • 29
  • +0/-0
Re: Mysql db error
« Reply #2 on: October 07, 2008, 07:37:27 PM »
I always used to set up application user name ROOT and password XYZ. (sure different from default)

The strange thing is that if my default password is right and didn't change, why phpmyadmin give me this error? Without it I can do anything.

Maybe I can from command line, but I'm not so good with mysql.

How can I be sure that default psw is the right one? ( I suppose that if I login as root and type mysql and it runs, the default is right, isn't it?)

If answer is YES, than with SELECT Host, User FROM mysql.user; I see 6 users, two of them are root. Can I change the password for all these 6 user with this command?

SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');

or for the two root user is better to do nothing while they use the default password. ( I'm really confuse about the default password and the password a root user can have.....)

« Last Edit: October 07, 2008, 07:48:42 PM by dede77b »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Mysql db error
« Reply #3 on: October 07, 2008, 07:43:21 PM »
I always used to set up application user name ROOT and password XYZ. (sure different from default)
That is a bad thing, you should never setup the users like that. There is only one root user for localhost, you can not create multiple and if you change the password you will criple your SME Server. In general the MySQL root user is only used as an administrative account as it has way to much privileges and implies a havy security risk when used.

Badly written code could execute code on your MySQL database that only a root user is allowed to do, leaving other applications making use of another MySQL database on your system criple or dead-in-the-water while you are clueless what happened. Reset your MySQL root password and after that generate a proper account with a different username for your application. That will save you a lot of problems, puling of hair and scratching your bold scarf after that. ;-)
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline dede77b

  • **
  • 29
  • +0/-0
Re: Mysql db error
« Reply #4 on: October 07, 2008, 09:28:01 PM »
It seems to run now  :-P

I change the two root user password in mysql, and change this password in the configuration file of my application and it looks great.

I will check all tomorrow morning.

Thanx a lot for your help.

Cheers Fred

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Mysql db error
« Reply #5 on: October 07, 2008, 09:54:00 PM »
It seems to run now  :-P

I change the two root user password in mysql, and change this password in the configuration file of my application and it looks great.
I hope you not only changed passwords but that you are also not using the root user for your application anymore.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline dede77b

  • **
  • 29
  • +0/-0
Re: Mysql db error
« Reply #6 on: October 07, 2008, 10:57:07 PM »
In fact I'm accessing my DB with the root user.

I check my databases, and all of these have ALL PRIVILEGES set for both root users.

I'm assigning these databases to a new user, but I have to mantain the same privileges? (all privileges) Or give less permission?

And last, do I have to remove root privileges to databases HORDE and MYSQL too?

Thank you again,

Fred

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Mysql db error
« Reply #7 on: October 07, 2008, 11:45:02 PM »
In fact I'm accessing my DB with the root user.

Well, you shouldn't do that.

Quote
I'm assigning these databases to a new user, but I have to mantain the same privileges? (all privileges) Or give less permission?

And last, do I have to remove root privileges to databases HORDE and MYSQL too?

You've already been told multiple times what you should do. Create a different user and use that for your application. Read the good documentation which has been provided. Sleep well at night.