Configuring MySQL With Reahl 5.0

19 views
Skip to first unread message

hen...@brightedge.co.za

unread,
Jan 26, 2021, 5:33:17 AM1/26/21
to Reahl discuss
I have trouble configuring a component to use MySQL. Although I (think) I changed the configuration, it still tries to log on to MySQL with "root" and no password.

Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Dropbox\Projects\reahl_env\Scripts\reahl.exe\__main__.py", line 7, in <module>
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\shelltools.py", line 206, in execute_one
    result = cls().do(sys.argv[1:])
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\shelltools.py", line 111, in do
    return self.execute(args)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\shelltools.py", line 226, in execute
    return super().execute(args)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\shelltools.py", line 170, in execute
    return command.do(args.command_args)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\shelltools.py", line 111, in do
    return self.execute(args)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\commands\prodshell.py", line 166, in execute
    create_with_password=not args.no_create_password)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\component\dbutils.py", line 174, in create_db_user
    return self.db_control.create_db_user(super_user_name=super_user_name, create_with_password=create_with_password)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\mysqlsupport.py", line 84, in create_db_user
    login_username=super_user_name, password=self.get_superuser_password())
  File "d:\dropbox\projects\reahl_env\lib\site-packages\reahl\mysqlsupport.py", line 69, in execute
    connection = MySQLdb.connect(**login_args)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\MySQLdb\__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "d:\dropbox\projects\reahl_env\lib\site-packages\MySQLdb\connections.py", line 179, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

hen...@brightedge.co.za

unread,
Jan 26, 2021, 5:38:13 AM1/26/21
to Reahl discuss
reahl.config.py
reahlsystem.connection_uri = 'mysql://TestUser1:MyPassword@localhost/BEEWebSite'  

.reahlproject
<project type="egg">
 <version number="0.0">
  <deps purpose="run">
   <egg name="reahl-component"/>
   <egg name="reahl-web"/>
   <egg name="reahl-sqlalchemysupport"/>
   <egg name="reahl-web-declarative"/>
   <egg name="reahl-mysqlsupport"/>
  </deps>
 </version>
</project>

Craig Sparks

unread,
Jan 26, 2021, 6:41:42 AM1/26/21
to reahl-...@googlegroups.com

Hi,

please check your config with this command:

reahl listconfig -v etc

where I am assuming that "etc" is the name of your config directory. The setting you have made should show up - this would confirm that the settings you have made are indeed in play.


It seems you are issuing the "reahl createuser" command. Have you already run the "reahl createdb" command or does the database exists already in MySQL?


Regards,

Craig.

--
You received this message because you are subscribed to the Google Groups "Reahl discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reahl-discus...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/reahl-discuss/21a835c5-62c9-4152-a08a-64074764a54bn%40googlegroups.com.

Craig Sparks

unread,
Jan 26, 2021, 7:32:03 AM1/26/21
to reahl-...@googlegroups.com

Also, the fact that you are using the MySql support plugin for mysql db, causes the

"reahl createdbuser etc" to default the username to the privileged user usually called "root" (it can be changed with the -U arg to "reahl createdbuser").

You need to have an environment variable called MYSQL_PWD, set to the privileged user password.

Your settings in reahl.config.py will be used to create the user you need.


Craig.

Hendrik du Toit

unread,
Jan 26, 2021, 7:38:38 AM1/26/21
to Reahl discuss
1.  See below the output of "reahl listconfig -v etc"
2.  Yes, I am issuing the "reahl createdbuser" command.  I have executed the "reahl createdb" command.  It gives the same error
3.  The database does not exist in MySQL.

Output of  reahl listconfig -v etc  
reahlsystem.connection_uri              mysql://TestUser1:1re$UtseT@localhost/BEEWebSite

reahlsystem.databasecontrols            [<class 'reahl.sqlitesupport.SQLiteControl'>, <class 'reahl.mysqlsupport.MysqlControl'>, <class 'reahl.component.dbutils.NullDatabaseControl'>]
reahlsystem.debug                       True
reahlsystem.orm_control                 <reahl.sqlalchemysupport.sqlalchemysupport.SqlAlchemyControl object at 0x0000017CCCED4F88>

reahlsystem.root_egg                    BEEWebSite
reahlsystem.serialise_parallel_requests False
reahlsystem.translation_packages        [<module 'reahl.messages' (namespace)>, <module 'reahl.messages' (namespace)>, <module 'reahl.messages' (namespace)>, <module 'reahl.messages' (namespace)>, <module 'reahl.messages' (namespace)>, <module 'i18nexamplebootstrapmessages' from 'd:\\dropbox\\projects\\reahl_examples\\i18nexamplebootstrap\\i18nexamplebootstrapmessages\\__init__.py'>]
mail.smtp_certfile                      None
mail.smtp_host                          localhost
mail.smtp_keyfile                       None
mail.smtp_password                      None
mail.smtp_port                          8025
mail.smtp_upgrade_initial_connection_to_encrypted       False
mail.smtp_use_initial_encrypted_connection      False
mail.smtp_user                          None
web.cache_max_age                       600
web.debug_concurrency_hash              False
web.default_http_port                   8000
web.default_http_scheme                 http
web.default_url_locale                  en_gb
web.encrypted_http_port                 8363
web.encrypted_http_scheme               https
web.frontend_libraries                  <reahl.web.libraries.LibraryIndex object at 0x0000017CCDAA4D88>
web.guest_key_lifetime                  31536000
web.guest_key_name                      reahl-guest
web.idle_lifetime                       7200
web.idle_lifetime_max                   1209600
web.idle_secure_lifetime                3600
web.persisted_exception_class           <class 'reahl.webdeclarative.webdeclarative.PersistedException'>
web.persisted_file_class                <class 'reahl.webdeclarative.webdeclarative.PersistedFile'>
web.persisted_userinput_class           <class 'reahl.webdeclarative.webdeclarative.UserInput'>
web.session_class                       <class 'reahl.webdeclarative.webdeclarative.UserSession'>
web.session_key_name                    reahl
web.session_lifetime                    1209600
web.site_root                           <class 'BEEWebsite.BEEWebsiteUI'>
web.static_root                         D:\Dropbox\Projects\BEEWebSite\0100\Code\BEEWebsite


Craig Sparks

unread,
Jan 26, 2021, 7:41:40 AM1/26/21
to reahl-...@googlegroups.com

Great, then your settings are fine.

did you notice my previous post:


"

Also, the fact that you are using the MySql support plugin for mysql db, causes the

"reahl createdbuser etc" to default the username to the privileged user usually called "root" (it can be changed with the -U arg to "reahl createdbuser").

You need to have an environment variable called MYSQL_PWD, set to the privileged user password.

Your settings in reahl.config.py will be used to create the user you need.

"


Hendrik du Toit

unread,
Jan 26, 2021, 7:46:29 AM1/26/21
to Reahl discuss
The  environment variable called MYSQL_PWD  seem to have done the trick .  Thanx.  Not sure if I missed it in the documentation?

Craig Sparks

unread,
Jan 26, 2021, 7:47:34 AM1/26/21
to reahl-...@googlegroups.com

Thanks for the feedback. I will check the docs and make sure.

Reply all
Reply to author
Forward
0 new messages