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 …

DBA

Deleting Records in Nested BSON Array from MongoDB

When you are trying to manipulate data within nested BSON array in MongoDB, things get complex. Luckily, MongoDB has the ability to pass a JavaScript-like function to forEach to manipulate or query data. Let’s take a look at the data below. Sample Data { “_id”: ObjectId(“5a2f38458bcodgerce87vds”), “customerId”: “45632”, “cart”: { …

DBA

How to Manually Create Database Backup for SQL Server

Occasionally, I need to create a database backup from SQL Server manually on demand. It is a handy thing to know. Once the backup is created, it can be loaded to other SQL Server. This often happens when a developer wants to get the database from other environment or even …

DBA

How to Restore AdventureWorks to SQL Server Express

Once you have SQL Server Express installed on your local machine, you may want to load some example data so that you can play around with it. After all, what’s good with the database without data! MySQL comes with the Sakila database upon installation. SQL Server’s equivalent would be AdventureWorks …

DBA

How to Connect to Locally Installed SQL Server Express with JDBC

Once you install SQL Server Express locally, you need to go through a few configuration steps to connect to the server with JDBC. Tools In this demo, I am using SQL Workbench to connect to the server. SQL Server Express is 2017 version. JDBC is 7.1.x from Maven Repo. Steps …

DBA

How to Enable User Login with SQL Server Express

This post explains steps for enabling the server authentication mode (logging in with username and password) after installing SQL Server Express in your local machine. This is based on 2017 version, but it also works for older ones. SQL Server Express comes with the default Windows Authentication mode when you …

DBA

How to Prevent Creating Duplicate Keys in MongoDB

In MongoDB, the primary key is reserved for the _id field. This is a system field and gets created by default when inserting new records. When you want to enforce the uniqueness in other fields, you can use unique index. Here is how to create unique index with Mongo Shell. …

DBA

MongoDB Skills Essential Exercise

MongoDB is probably the most prevalent NoSQL database choice for the backend of web applications. It is an open source and relatively easy to use. It works well with the modern web applications written in Node.js or Python Django. Enterprise-level web application platforms like Sitecore (works on .NET) also use …

DBA

User Management with MongoDB

MongoDB does not have authentication out of box. When you install it, the first thing you have to do is to create an admin user in the admin database and enable authentication. After installation, you can get into MongoDB with the mongo command from the Mongo Shell. mongo Let’s create …

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 …