Creating an installation script

When we develop an application that interacts with a database, we need to create a script that recreates the same database structure on other computers. The creation of the application database is part of the installation process.

This database install script is usually a text file that contains the SQL commands to create the database. By convention, this file has a .sql extension. As mentioned in Chapter 1, Installing MariaDB, the most common way to execute a file containing queries is by passing it to the mysql command-line client. For example:

mysql -uroot -pmypassword < install_db.sql

The fastest way to create such a script is by using mysqldump. This tool, mainly used to create backups, will be discussed in ...

Get MariaDB Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.