Mysql: Difference between revisions

From NixOS Wiki
imported>Onny
No edit summary
Klinger (talk | contribs)
m links to mysql and mariadb and second example to differentiate between both engines
 
Line 1: Line 1:
MySQL is a widely used open source relational database management system (RDBMS) that offers various features, tools, and services for data warehousing, analytics, machine learning, and more. MariaDB is a popular and stable fork of MySQL that is compatible with MySQL and has additional enhancements and features.
[https://www.mysql.com MySQL] and [https://mariadb.org MariaDB] are installed via the same services.mysql configuration.  


= Setup =
* MySQL is a widely used open source relational database management system (RDBMS) that offers various features, tools, and services for data warehousing, analytics, machine learning, and more.
* MariaDB is a popular and stable fork of MySQL that is compatible with MySQL and has additional enhancements and features.


Setup and enable Mysql (MariaDB) database daemon
= Setup MySQL =
 
Setup and enable Mysql database daemon (in this example: latest stable version in nixpkgs)
 
<syntaxhighlight lang="nix">
services.mysql = {
  enable = true;
  package = pkgs.mysql;
};
</syntaxhighlight>
= Setup MariaDB =
 
Setup and enable MariaDB database daemon (in this example: version 11.0)


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.mysql = {
services.mysql = {
   enable = true;
   enable = true;
   package = pkgs.mariadb;
   package = pkgs.mariadb_110;
};
};
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 17:47, 29 September 2024

MySQL and MariaDB are installed via the same services.mysql configuration.

  • MySQL is a widely used open source relational database management system (RDBMS) that offers various features, tools, and services for data warehousing, analytics, machine learning, and more.
  • MariaDB is a popular and stable fork of MySQL that is compatible with MySQL and has additional enhancements and features.

Setup MySQL

Setup and enable Mysql database daemon (in this example: latest stable version in nixpkgs)

services.mysql = {
  enable = true;
  package = pkgs.mysql;
};

Setup MariaDB

Setup and enable MariaDB database daemon (in this example: version 11.0)

services.mysql = {
  enable = true;
  package = pkgs.mariadb_110;
};

Maintenance

Upgrade

NixOS will not run mysql_upgrade automatically for you after upgrading to a new major version, because it is a "dangerous" operation (can lead to data corruption) and users are strongly advised (by MariaDB upstream) to backup their database before running mysql_upgrade.

mysqldump -u root -p --all-databases > alldb.sql

After backup is completed, you can proceed with the upgrade process

mysql_upgrade