Error: Host is not allowed to connect to this MySQL server

Problem When you try to connect to MySQL remotely, you get the following error: Host <hostname or IP> is not allowed to connect to this MySQL server In MySQL, hosts are allowed (whitelisted) per user. So this error means the user you’re trying to connect with doesn’t have your remote host whitelisted. You’re likely trying … Read more

C# – Connect to a MySQL database

The simplest way to connect to a MySQL database in a .NET project is to use the MySql.Data package (from Oracle). It provides classes that implement the standard ADO.NET interfaces (such as IDbConnection). First, add the MySql.Data package to your project (this is using View > Other Windows > Package Manager Console): Now use the … Read more

SQL – Sort into groups, then sort within groups

I recently came across a complex sorting problem that required sorting the data into groups, then further sorting the data within each group. I’ll explain this problem with a concrete example, and then I’ll show the SQL query I used to solve the problem. Let’s say we have orders, departments, and users. Users can be … Read more