0
$\begingroup$

I have locally installed and run the latest version of Oracle MySQL Community Server 8.0 on port 3306. I successfully established connections to it from locally installed Oracle MySQL Workbench 8.0 Community Edition (screenshot) and from DBeaver 21.2.

I wish to connect to it from Mathematica taking the advantage of the External Language Input and RelationalDatabase functionality.

Here is my attempt:

refMySQL = 
 DatabaseReference[{"Backend" -> "mysql", "Port" -> 3306, "Host" -> "localhost", 
   "Username" -> "admin", "Password" -> "admin", "Name" -> "sys"}];

DatabaseConnect@refMySQL

output

The error description is: "Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python".

Evaluating RelationalDatabase@refMySQL or StartExternalSession@refMySQL produces the same Failure message.

I also tried changing "Backend" to "oracle" and "Username" to "root" with the same result.

How to connect to the database?

I have installed and configured Python 3.9.7, which works well from Mathematica:

screenshot

$\endgroup$
4
  • $\begingroup$ If I look in the documentation it seems you should use an association instead of a list. Would that make a difference? $\endgroup$ Jan 14 at 22:58
  • $\begingroup$ @SjoerdC.deVries It doesn't make a difference. With DatabaseReference[<|"Backend"->"mysql","Port"->3306,"Host"->"localhost","Username"->"admin","Password"->"admin","Name"->"sys"|>] I get the same error. $\endgroup$ Jan 15 at 0:19
  • $\begingroup$ In the meanwhile, you could try connecting using the older DatabaseLink which I understand uses Java instead of Python internally. $\endgroup$ Jan 15 at 16:02
  • $\begingroup$ @GustavoDelfino I have trouble configuring "DatabaseLink`". Do you have a ready-made configuration for local MySQL 8.0? $\endgroup$ Jan 15 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.