Page 1 of 1

[SOLVED][PyPlanet] Database access error

Posted: 30 Jun 2018, 10:49
by elie520
Hi,

I'm trying to configure PyPlanet on one of my serverss. I followed the PyPlanet documentation (see http://pyplanet.readthedocs.io/en/lates ... ation.html). When I try to start the controller with

Code: Select all

./manage.py start
j'ai l'erreur suivante :

Code: Select all

peewee.InternalError: (1698, "Access denied for user 'me'@'localhost'")
What surprises me, is that I don't need a pw to access my mysql, so I don't understand. Here is my basy.py DATABASES part:

Code: Select all

DATABASES = {
        'default': {
                'ENGINE': 'peewee_async.MySQLDatabase',
                'NAME': 'ma_db',
                'OPTIONS': {
                        'host': 'localhost',
                        'user': 'me',
                        'password': ' ',
                        'charset': 'utf8mb4',
                }
        }
}
If you have any idea, i'd be glad :)

Thanks!

Re: [PyPlanet] Database access error

Posted: 30 Jun 2018, 16:30
by toffe
Hello elie520,

First of all, thanks trying out PyPlanet. I think you made a small mistake in your password configuration. When you have a MySQL user without a password, just enter an empty string (so not with the space, you currently have).

Adjusted version of your provided configuration file with the space replaced by just an empty string:

Code: Select all

DATABASES = {
        'default': {
                'ENGINE': 'peewee_async.MySQLDatabase',
                'NAME': 'ma_db',
                'OPTIONS': {
                        'host': 'localhost',
                        'user': 'me',
                        'password': '',
                        'charset': 'utf8mb4',
                }
        }
}
Please let me know if this worked out for you, and if you need any further asssitance,

Thank you,
Toffe

Re: [PyPlanet] Database access error

Posted: 30 Jun 2018, 17:02
by elie520
Hi, thanks for your answer.
Sorry for this, I actually tried it first with the empty string. I just tried several things to make it work before posting here, including entering a random password, or a ' ' password. In either cases, I get the same problem. Actually, I do everything under root privilege, and root session, is that a problem? For this post I wrote 'me' but it's actually root all along.

Thanks for your help!!

Re: [PyPlanet] Database access error

Posted: 30 Jun 2018, 18:19
by toffe
Hi,

It might be that the user root doesn't have the right privileges from the pyplanet instance. A better solution would be to create a separate account and grant the database rights to that specific account.

Hit me up on discord and I'll help you complete your installation :-) : Toffe#8999

Toffe

Re: [PyPlanet] Database access error

Posted: 30 Jun 2018, 18:55
by elie520
Many many many many thanks to toffe <3

It indeed worked with a new account with all the permissions to the database. In MySQL:

Code: Select all

CREATE USER 'new_user'@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON the_server_db.* TO 'new_user'@'localhost';
and in basy.py:

Code: Select all

DATABASES = {
        'default': {
                'ENGINE': 'peewee_async.MySQLDatabase',
                'NAME': 'the_server_db',
                'OPTIONS': {
                        'host': 'localhost',
                        'user': 'new_user',
                        'password': '',
                        'charset': 'utf8mb4',
                }
        }
}
Once more, thank you very much <3

Re: [SOLVED][PyPlanet] Database access error

Posted: 30 Jun 2018, 18:59
by toffe
No problem. I'm happy that it's solved. Enjoy using PyPlanet :-)