DBA

mysqldump Error: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)

mysqldump 8 enabled a new flag called columm-statistics by default. When you have MySQL client above 8 and try to run mysqldump on older MySQL versions, you will get the error below. mysqldump: Couldn’t execute ‘SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM ‘$”number-of-buckets-specified”‘) FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = ‘myschema’ AND TABLE_NAME = ‘craue_config_setting’;’: Unknown …

.NET

Unit Testing Entity Framework Database Update logic with NSubstitute

In the previous post (UnitTesting ASP.NET Web API by Mocking DbContext with NSubstitute), we explored how to create a unit test for getting data from database with Entity Framework by mocking DbContext and DbSet.  We are going to build upon the API we created previously and add PUT logic where …

.NET

Creating Web APIs using ASP.NET and MySQL in 5 minutes

Creating a web API that interact with a database with C# is quite easy thanks to ASP.NET and Entity Framework. Building API with ASP.NET is essentially creating a MVC application without View. If you learn how to create a website with ASP.NET, you can apply the skills directly to API …

Data Engineering

How to Bulk Load Data into MySQL with Python

As in any other relational databases, the fastest way to load data into MySQL is to upload a flat file into a table. To do this, MySQL has a LOAD DATA INFILE function. We can use Python to execute this command. To connect to MySQL and execute SQL statements with …

DBA

How to Prevent Blocked Host Connection from Many Connection Errors in MySQL

MySQL has a parameter called max_connect_errors to prevent user from connecting to the database if they make too many connection errors (e.g. from wrong password) for security reason. The default for this value is 10. In case of AWS RDS, I don’t think the value is set. Therefore, when you …

DBA

How To Create Users and Grant Privileges in MySQL

Managing user access in MySQL is similar to Postgres (see Postgres user creation here). You can either manage the access privileges through roles or give privileges directly to users. This post is a quick reference for granting privileges to users. Let’s have a look at a simple use case. We …