Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied for user 'root'@'localhost' (using password: NO) #30

Open
mKay00 opened this issue Jan 16, 2020 · 10 comments
Open

Access denied for user 'root'@'localhost' (using password: NO) #30

mKay00 opened this issue Jan 16, 2020 · 10 comments

Comments

@mKay00
Copy link

mKay00 commented Jan 16, 2020

I used Mobius_Docker, but I can't get it to work. When it's started, I get repeatedly the following output

node_1  | GET : /Mobius
node_1  |
node_1  | GET : /Mobius
node_1  | get_resource_from_url (hokpoASd) - /Mobius: 2.846ms
node_1  | get_resource_from_url (z_wpz8jS) - /Mobius: 3.322ms
node_1  | {"rsc":"5000","ri":"GET-/Mobius-{\"fu\":2,\"rcn\":1,\"rt\":3}","msg":"database error"}
node_1  | Target CSE(localhost) is not ready
node_1  | Target CSE(localhost) is not ready
node_1  | {"rsc":"5000","ri":"GET-/Mobius-{\"fu\":2,\"rcn\":1,\"rt\":3}","msg":"database error"}

Since the message says database error, I looked what the database does and at the end of the database setup it says

db_1    | 2020-01-16T15:00:53.686717Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)

So, I am wondering how I could fix the issue. I already tried it on another PC, on Linux and Windows and also followed the steps for manual installation from the installation guide. I always get a database error. I also tried different solutions I found on the internet for the Access denied error, but nothing seems to work for me.

I would really appreciate some help here, since I ran out of options to try.

The version of MySQL is 5.7.28.

@hsebs
Copy link

hsebs commented Jan 19, 2020

Mysql returns "Access denied for user" when authentication plugin is wrong.
Mobius uses mysql_native_password as authentication plugin.

Check authentication plugin of mysql account.
SELECT user,plugin,host FROM mysql.user;

@lovele0107
Copy link

Hi, I used also the Mobius_Docker and got the same error.
connecting to mysql account , I checked the plugin is mysql_native_password.
Could you please help ?
Thanks.

@hsebs
Copy link

hsebs commented Jan 22, 2020

@lovele0107
Try flush privileges;

@lovele0107
Copy link

Hi .
I went to mysql using command: sudo docker exec -it mobius_docker_db_1 mysql -u root -p
then I have tried : flush privileges, but it does not solve the issue.

@mKay00
Copy link
Author

mKay00 commented Jan 23, 2020

Same for me. I checked the authentication plugin and tried flush privileges. The plugins are mysql_native_password:
image

and flush privileges shows OK:
image

But I still get access denied afterwards, when I docker-compose up

edit: When I use docker-compose up, it says Recreating mobius_docker_db_1, does this mean that the flush privileges doesn't have an effect, because it always creates a new image? If so, what would be the correct way to do this?

@hsebs
Copy link

hsebs commented Jan 23, 2020

I installed Mobius Docker and got a same result.
I found that mysql on mobius_docker_db_1 does not have any table.

image

@hsebs
Copy link

hsebs commented Jan 23, 2020

@mKay00
@lovele0107

I found the cause.
IoTKETI removed sql directory from Mobius but Mobius_Docker still uses it.

Enter

mkdir sql
cp ./mobius/mobiusdb.sql ./sql/mobiusdb.sql

after Mobius_Docker Installation step 4.

It will works well.

image

P.S. MySQL stll returns access denied error, but I don't know who try to access.

@lovele0107
Copy link

HI , I confirm it is working now. The rights of the sql file would need to be changed in order to be in the same user group. ( or do not use sudo for copying the sql file)
Thank you very much for your prompt reply to this issue.

@mKay00
Copy link
Author

mKay00 commented Jan 24, 2020

Thank you, although I am still getting Access denied for user 'root'@'localhost', it works now.

@hsebs
Copy link

hsebs commented Jan 24, 2020

@mKay00
I found the cause.
healthcheck command of Mobius_Docker is wrong.

image

Command should include password.

image

Change line 18 of docker-compose.yml in Mobius Docker
from

test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]

to

test: ["CMD", "mysqladmin" , "--password=dksdlfduq2","ping", "-h", "localhost"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants