Practical solutions

MySQL Howtos How-To Guides

Solve the problem. Keep building. Collection of MySQL how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Show Table and Database Structure in MySQLThis tutorial demonstrates the use of the mysqldump utility, DESCRIBE, SHOW TABLES, and SHOW CREATE TABLE statements to show table and database structures in MySQL. How to Add the Primary Key to a MySQL TableThis tutorial demonstrates how to add the primary key to a MySQL table using CREATE TABLE and ALTER TABLE statements. How to Select the First Row From the MySQL TableThis tutorial educates about how we can select the first row from a MySQL table. How to Reset the MySQL Root Password in UbuntuThis tutorial demonstrates how to reset the MySQL root password in Ubuntu when we forgot it and we cannot set a root password. How to Insert Timestamp Into a MySQL TableThis tutorial demonstrates different approaches to insert timestamp into a MySQL table depending on table definition. How to Convert From Datetime Type to Date Only in MySQLThis tutorial demonstrates the use of DATE(), CAST(), CONVERT(), and DATE_FORMAT() to convert from datetime type to date type in MySQL. How to Use, Benefits, and Alternative of the Zerofill in MySQLThis tutorial educates about the use of zerofill in MySQL and its benefits. It also highlights the use of the zerofill attribute's alternative function. How to Append Strings to an Existing Field in MySQLThis tutorial educates how we can use CONCAT() and CONCAT_WS() to append strings to an existing field in MySQL. How to Process Form Data With Mysqli_real_escape_stringThis article teaches you how to process form data using mysqli_real_escape_string. We'll set up a local server, create the database and a table. Afterward, you'll learn how to prevent an error when using mysqli_real_escape_string. How to Enable Slow Query Log in MySQLThis tutorial demonstrates how to enable slow query log in MySQL using Windows and Ubuntu. How to Use Mysqldump Gzip to Create a Compressed File for a MySQL DatabaseThis tutorial educates about using mysqldump gzip and crontab to create a compressed backup file for a MySQL database. How to Generate Random and Unique Strings in MySQLThis tutorial demonstrates how to generate random and unique strings in MySQL. How to Connect a Remote MySQL Database Using the Command LineThis tutorial demonstrates how to connect a remote MySQL database using the command line. How to Change MySQL Root Password on MacThis article teaches you how to change the MySQL root user password on OSX. We'll use XAMPP, so you can change the password using the MySQL console. How to Update Multiple Tables With One Query in MySQLThis article introduces how to update multiple tables with one query in MySQL. How to MySQL Check if Column Is Null or EmptyThis article introduces how check if a column is null or empty in MySQL. How to Open MySQL Using Mac TerminalThis article will teach you how to open MySQL using a Mac terminal. We'll show you how to do this on macOS Catalina and later. And also, macOS Mojave and earlier. How to Use CURRENT_TIMESTAMP as Default in MySQLThis article teaches you how to use CURRENT_TIMESTAMP as DEFAULT in MySQL versions less than 5.6.5. As a result, you can prevent MySQL Error 1293. Our methods include reordering the table columns, using DEFAULT 0, and a time value. How to Create Table Alias With MySQL VIEW and MERGEThis article will teach you how to create a table alias using MySQL VIEW and MERGE. In both cases, changes in the original table will reflect in the aliased table. Also, the results of SELECT queries on the aliased and original table will be the same. How to Sort MySQL Data in Alphabetical OrderThis tutorial demonstrates how to sort data in a MySQL server in alphabetical order. How to Show Foreign Keys in MySQLThis tutorial demonstrates how to showcase the foreign keys of a table and a column in MySQL. How to Find Value in a Set in MySQL DatabaseThis tutorial demonstrates how to check the occurrence of a value or find a value in a set in a MySQL database. How to Calculate Average of a Table Column in MySQLThis tutorial demonstrates how to calculate the average of a column in MySQL. How to Select Multiple Values Using WHERE in MySQLThis article will discuss using the WHERE clause in SQL queries. Moreover, it will discuss different methods for selecting multiple values using the WHERE clause.