Method 1: Using the SET PASSWORD Command Syntax: mysql> SET PASSWORD FOR username@localhost = PASSWORD('new_password'); Example: mysql> SET PASSWORD FOR root@localhost = PASSWORD('123'); Method 2: Using mysqladmin Syntax: mysqladmin -u username -p old_password password new_password Example: mysqladmin -uroot -p123456 password 123 Method 3: Directly Editing the user Table with UPDATE 1. Log in to MySQL. […]
Almost every programmer working with databases (or perhaps your colleagues) will encounter this issue: how to quickly roll back after an accidental operation in MySQL? For example, deleting a table without adding a condition, resulting in the entire table being wiped out. If this happens in a production environment with critical business data, it could […]
How to Display All Users in MySQL?
This is a common question asked by MySQL beginners. Today, let's explore how to display all users in MySQL. Typically, in MySQL, we use SHOW DATABASES to display all databases and SHOW TABLES to display all tables. So, you might assume the command to display all users is SHOW USERS, right? Nope, that's not the […]
Hard Drive Principles Hard drives are the last mechanical storage component inside modern computers, operating at speeds significantly slower than memory or cache. However, due to their relatively low cost, they are well-suited for permanent storage. To mitigate the challenges posed by slower speeds, operating systems apply various optimizations. Let’s first understand the fundamental principles […]
Differences Between MySQL and SQL Server
Differences Between MySQL and SQL Server MSSQL (SQL Server) originated as a product of collaboration between Sybase and Microsoft. For developers, the two most commonly used backend databases are currently MySQL and SQL Server. Their fundamental similarity lies in data storage and querying systems. You can use SQL to access data in both databases, as […]
30 Tips for Database Optimization
30 Tips for Database Optimization 1. Optimize queries to avoid full table scans. Prioritize creating indexes on columns involved in WHERE and ORDER BY clauses. 2. Avoid checking for NULL values in the WHERE clause, as this will cause the engine to bypass indexes and perform a full table scan. For example: select id from […]
What is an SQL Server Deadlock? A deadlock is often confused with regular blocking. When a transaction requests a lock on a resource already locked by another transaction, the requesting transaction must wait until the lock is released. By default, SQL Server transactions do not time out unless LOCK_TIMEOUT is set. In such cases, the […]
In our last post, we talked about how to mount a disk in AWS. Today, let's see hwo to fix the issue when you are unable to remote login to AWS due to the firewall. Problem Description When the AWS firewall is enabled (sudo ufw enable), all external access to the instance (e.g., using xshell) […]
How to Mount a Disk in AWS EC2?
In our last post, we talked about how to check for unreleased cursors in SQL Server. Today, let’s see how to mount a disk in AWS. Steps to mount a disk in AWS 1. Create an EC2 instance. 2. Create an EBS volume and associate it with the EC2 instance via the console (Make sure […]
In our last post, we talked about how to obtain the start and end time of mysql binlogs. Toaday, let's see how to check for unreleased cursors in SQL Server. I’ve never been particularly enthusiastic about using cursors in SQL Server and rarely use them. Recently, a user asked how to check for unreleased cursors […]