≡ Menu


If you have data in a text file, you can easily upload them to one or more tables in a database. In MySQL database (or MariaDB), using "load data infile" command, you can upload data from a text file to tables. The load data infile command provides several flexible options to load various formats of [...]

{ 1 comment }

10 Essential MariaDB / MySQL DELETE Command Examples

When you are working on MySQL database, on several situations you may want to delete existing records from one or more tables. In this tutorial, we'll explain how to use MySQL Delete with some useful examples. The following are covered in this tutorial: Delete a specific row Delete multiple rows (using number column matching) Delete [...]


How to Connect to MySQL Database from Python With Example

From a Python program, you can connect to MySQL database to access the tables and manipulate your data. For this, you should use one of the Python MySQL Libraries. While there are few of these libraries available, the most popular and stable is mysql-connector-python library. The mysql-connector-python library uses APIs that are complaint with the [...]


11 Essential MySQL Update Command Examples

One of the most common MySQL operation is to change an existing value of a record in a table. In this article, we’ll explain how to use MySQL update command along with some helpful examples. The following are covered in this tutorial: Update All Rows Update Only Selected Rows Update Column Value with Expression DEFAULT [...]


By default MySQL database will be created under /var/lib/mysql directory. This might be Ok if you are running a small database that doesn’t take much space. But on production, for a larger database, you might not have enough space under root partition. In that case, you may want to move your MySQL database from root [...]


How to Optimize MySQL Tables and Defragment to Recover Space

If your application is performing lot of deletes and updates on MySQL database, then there is a high possibility that your MySQL data files are fragmented. This will result in lot of unused space, and also might affect performance. So, it is highly recommended that you defrag your MySQL tables on an ongoing basis. This [...]


How to Shrink MySQL ibdata1 Size using innodb_file_per_table

In MySQL, when you are using InnoDB, all the tables and indexes are stored under the MySQL system tablespace. MySQL system tablespace is ibdata1, which is located under /var/lib/mysql The single ibdata1 file contains all the tables and indexes in your MySQL database. So, if you have a big database, this file size will grow [...]


12 Essential MySQL Insert Command Examples

One of the common MySQL operation is to insert records into a table. This tutorial explains how to use MySQL insert command with several practical and useful examples. The following example will connect to devdb database with username devuser and password mysecretpwd # mysql -u devuser -pmysecretpwd devdb mysql> For this tutorial, we'll insert values [...]