How to Install MySQL and Import a Sample Database

If you are looking to learn SQL and want to follow along with the instructor, installing MySQL is the first step. MySQL is an open-source software, which means it is free for most end-users. It also offers a commercial license for more advanced database requirements.

How to Install MySQL and Import a Sample Database
How to Install MySQL and Import a Sample Database

Checking Compatibility and Downloading MySQL

Before installing MySQL, it’s important to check if your computer is compatible. You can review the MySQL forum for information about compatibility.

To download MySQL, visit the MySQL website and choose the right file based on your internet connection. If you have an online connection while running the MySQL Installer, select the “mysql-installer-web-community” file. If you do not have an online connection, choose the “mysql-installer-community” file.

Installing MySQL

Once the file is downloaded, double-click on it to begin the installation process. The MySQL installer program will guide you through the installation and allow you to choose the required options for your project.

If you have already installed some options, you can install additional options by selecting the product you want to install in the “Available Products” pane and clicking the arrow button to move it to the “Products and Features to be installed” pane. Then click “Next” to start the installation process.

Running MySQL Workbench

After the installation is complete, you can find the “MySQL Workbench 8.0 CE” in the “MySQL” folder in your programs. MySQL Workbench is a graphical tool for working with MySQL servers and databases.

Further reading:  Boolean Logic in PLC Function Blocks: Understanding the Fundamentals

Open MySQL Workbench and click on “MySQL Connections” > “Local instance MySQL80” to log in using the password created during the installation process.

Importing a Sample Database

To import a sample database, select the “File” menu button and choose “Open SQL Script”. In the opened window, select the script called “realparssampledatabasev2.sql” (available for download in the description).

After loading the script, click the lightning button to run it. This will create the RealPars database with tables, relationships, and sample data.

To verify the success of the script, check the bottom window for green checks indicating success or red X’s indicating failures.

Running Queries and Exporting Data

Now that the sample database is imported, you can run queries to analyze the data. For example, you can expand the “Tables” folder, right-click on the “students” table, and select “Select Rows, Limit 100” to see the top 100 records.

To export the query results to Microsoft Excel, click on the “Export recordset to an external file” button and choose the file format you prefer (such as “Excel Spreadsheet”). Give the file a name and save it to your desired location.

Conclusion

Installing MySQL and importing a sample database is the first step in learning SQL. MySQL Workbench is a powerful tool that allows you to interact with your databases and run queries. By following the steps outlined in this article, you can start exploring and analyzing data using MySQL.

If you have any questions or would like to learn more about a similar subject, please let us know in the comments. Stay tuned for future SQL lessons where we will explore more advanced SQL commands, automation, troubleshooting, and process development.

Further reading:  The Difference Between Absolute and Incremental Encoders

Please press the like button if you found this article helpful and visit Techal for more informative content on technology.

YouTube video
How to Install MySQL and Import a Sample Database