Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I am receiving an error while trying to connect to a MySQL database (using the MySQL data source) with Power BI:
It translates to:
Details: "An error happened while reading data from the provider: 'Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.'"
The weird thing is that the error does not occurr with databases served by the localhost mysql server, but with the internal network one. The database itself doesn't seem to be the problem - dumping the remote server, restoring it locally and then importing it into Power BI works flawlessly. I never tried connecting to a MySQL database not on localhost before so I don't know if this has always been like this.
There is no issue with connecting to the remote DB with MySQL workbench or pymysql
If I add a SQL query that select a table it also works instead of letting Power BI do the "work" then there are no issues. I want to avoid manually defining the SQL query.
- I uninstalled the MySQL NET connector and installed the current one MySQL :: Begin Your Download, 64 bit, like my system
- restarted my machine
- replicated on another machine
- tried the ODBC version of the Power BI import - MySQL is not in Power BI ODBC selection, but listed in ODBC Data Sources 64 bit, so I could not try if the ODBC version of the MySQL import works
Installed MySQL ODBC Connector, not used / available in Power BI
Used for import of MySQL DB in Power BI
Does anyone know what could be the reason for this / a solution?
I got this error by installing and starting PowerBI, trying to make some MySQL connections, uninstalling the MySQL Connector (which included the ODBC driver), they making a MySQL connection. Reinstalling the connector and restarting PowerBI fixed the problem.
I am still facing that issue - does anyone else have an idea on how to solve my problem / what else I could try out?
@Anonymous I would suggest to use the available MySQL Connector in Power BI.
** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !
Good Luck 👍
Hello @ghoshabhijeet,
thanks for your answer.
> Used for import of MySQL DB in Power BI
As stated in my post, I did indeed use the MySQL connector. I mentioned the ODBC way as another thing I tried out unsuccessfully.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 42 | |
| 21 | |
| 18 |