Skip to content
On this page

Installing MySQL

MySQL is currently the most widely used open-source relational database. It was originally developed by the Swedish company MySQL AB, which was acquired by SUN Microsystems in 2008, and subsequently, SUN was acquired by Oracle in 2009, making MySQL a product under Oracle.

Unlike other relational databases, MySQL itself is essentially just an SQL interface; it includes various storage engines internally, commonly including:

  • InnoDB: A transactional storage engine developed by Innobase Oy, acquired by Oracle in 2006.
  • MyISAM: The default storage engine integrated into early versions of MySQL, which does not support transactions.

The relationship between the MySQL interface and database engines is similar to that of a web browser and its rendering engine (like the IE engine or Webkit). For users, switching the browser engine does not affect the browser interface; likewise, changing the MySQL engine does not affect applications using the MySQL interface.

When using MySQL, different tables can use different storage engines. If you're unsure which engine to choose, remember to always select InnoDB.

Since MySQL was originally open-source, various open-source versions based on MySQL have been developed, including:

  • MariaDB: An open-source fork created by the original founders of MySQL, using the XtraDB engine.
  • Aurora: A MySQL version improved by Amazon, designed specifically for users hosting MySQL on AWS, claiming a 5x performance improvement.
  • PolarDB: A MySQL version improved by Alibaba, designed for users hosting MySQL on Alibaba Cloud, claiming a 6x performance improvement.

The official MySQL version is divided into several editions:

  • Community Edition: The open-source version, free to use.
  • Standard Edition: The standard version.
  • Enterprise Edition: The enterprise version.
  • Cluster Carrier Grade Edition: The cluster version.

The functionality of these versions increases sequentially, along with their pricing. However, the additional features mainly involve monitoring and management capabilities; the basic SQL functionalities remain the same across versions.

This provides a significant advantage: you can install the free Community Edition on your own computer for learning, development, and testing. When deploying, you can choose a paid premium version or a compatible version offered by a cloud service provider without needing to modify the application itself.

How to Install MySQL

To install MySQL, download the latest MySQL Community Server version from the official MySQL website:

https://dev.mysql.com/downloads/mysql/

Select the appropriate operating system version and follow the installation instructions. During installation, MySQL will automatically create a root user and prompt you to enter a root password.

To install MySQL on Linux, you can use the package manager for your distribution. For example, Debian and Ubuntu users can simply run the command:

apt install mysql-server

Once installed, MySQL will automatically run in the background. To verify that MySQL has been installed correctly, you can connect to the MySQL server using the command line program mysql.

At the command prompt, enter:

mysql -u root -p

Then enter the password. If everything is correct, you will be connected to the MySQL server, and the prompt will change to mysql>.

To exit the MySQL command line, type exit. Note that the MySQL server continues to run in the background.

Installing MySQL has loaded