MYSQL (Structured Query Language) is an open-source relational database management system (RDBMS). It is widely used for managing and organizing data in databases. It uses Structured Query Language (SQL) for accessing, adding, and managing the data held in a database.…
Category: MySQL
How to select or update MySQL table rows by even or odd number field value
In this simple tutorial I will show to select or update rows in your mysql table based on a stored even or add number in a specific field of your table. Your result might look like this: For example you…
How to create a user in MySQL/MariaDB and grant permissions on a specific database
To create a user in MySQL or MariaDB and granting it permissions to access a database is a basic task when deploying a new website on a LAMP stack server. To read and write data on a database is a very common…
How to enable MySQL slow query log and analyze it on Linux
MySQL slow query log is helpful when you needed to debug slow down or failure of your MySQL server. Slow query log can house queries which took more than n number of seconds.
Export, Import MySQL db between different servers through Linux command line
You should have Database name, Database Username, Database Password and command line access to your server Export database to local file system, for example /var/www/html
MYSQL – Useful commands you must know – Part-1
To know the current MYSQL version: SELECT version(); To format and formulate a float value: FORMAT(SUM(amount) * 0.6, 2) The above line sums up entire amount value, cut it down to 60% of total value and returns value precised up…
MySQL ‘show tables’: How to list tables in a MySQL database?
This is very commonly asked question: How do I show or list all the tables in a MySQL (or MariaDB) database using mysql command line tool? In brief, to show the tables in a MySQL database, run the command:
How to Replace a Text String in a MySQL Table Field Value
In this simple tutorial you will learn to replace a text string in a MySQL table field value. I have a races table in which I store race event information. In the date field I store event date. Since these…
Updating two columns with a subquery in MySQL
Sometimes you wanted to update columns of one MySQL table by quering another MySQL table and getting a column value from the later table. For example you have a ‘students’ table and you wanted to create a new field ‘totalMarks’…
To print the table structure of MySQL table in PHP
You can print the table structure of MySQL table in PHP using simple php script. All you need to do is to make a ‘describe table’ call and process it using php script, similar to one you use to print…