HOME BLOG

Archive for the ‘MySQL’ Category

How to fix error “my_config.h” file not found in MySQL-python on Mac OS

Posted on: September 30th, 2022 by Olu No Comments

Hi folks,

In this post I will briefly touch on how to fix the error that my_config.h could not be found when trying to install MySQL-python with pip on Mac OS 12.0.x with Python 2.7.x. We assume you installed MySQL via Homebrew.

The error looks like

    _mysql.c:44:10: fatal error: 'my_config.h' file not found
    #include "my_config.h"
             ^~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

 

First, download my_config.h using commands:

cd ~/Downloads
curl https://raw.githubusercontent.com/jacob5412/MySQL-Medium/main/my_config.h -o my_config.h

 

Next, find your MySQL version by running command

mysql --version

Let’s assume your version is 8.0.29.

Make sure the following directory exists /usr/local/Cellar/mysql/8.0.29/include/mysql/.

Then copy the downloaded my_config.h into the directory using command:

cp my_config.h /usr/local/Cellar/mysql/8.0.29/include/mysql/

That’s it. You can now install MySQL-python using command:

pip install MySQL-python

That’s all for now. Till next time, happy software development.

References

Fixing “my_config.h” file not found in MySQL-python (Mac OS). https://medium.com/the-rising-tilde/fixing-my-config-h-file-not-found-in-mysql-python-mac-os-ff97663a8042.

Tips for data modelling with MySQL Workbench

Posted on: February 6th, 2021 by Olu No Comments

Hi Folks,

In this post I’ll share  few tips when doing database modelling with MySQL Workbench.

If you need to create a table based on another, duplicate the old tables rather than creatiog the table from scratch. To do this. press Ctrl C, Ctrl V. Then update the table name.

Use separate multiple EER diagrams where appropriate. If working on a large database when multiple different concerns, consider using a separate EER diagram for each concern. Don’t shove all very many tables into a single EER diagram.

Double-check queries when synchronizing entity model with database. you will be surprised at some unexpected SQL you may occasionally find generated by MySQL Workbench. To avoid nasty surprises, always read through the SQL queries before applying them to your database.

Use MySQL Model tab to quickly view all tables in a MySQL Workbench file.

When copying tables, pay attention to autoincrement clause carried over from the old table, deleting it if necessary.

That’s all for now. Till next time, happy software development.

How to dump stored MySQL routines

Posted on: June 12th, 2020 by Olu No Comments

Hi folks,

In this post I will quickly share how to make a MySQL dump of stored routines (procedures and functions). Recently, I was looking to back up databases for a MySQL server which I maintain. One of the databases contained a stored function. So, I thought, heh, let’s just use the good old mysqldump the way I do it with tables. Well, it didn’t work. After a bit of Googling and searching MySQL documentation, I eventually found the answer. All you have to do is add the routines flag when invoking mysqldump.

E.g.

 

mysqldump --routines -u youruser -p yourdb > yourdb.sql

 

That’s all for now.