One place for hosting & domains

      Installing

      Installing MySQL: A Definitive Guide


      MySQL is one of the most popular SQL-based relational databases. The Community Edition is available at no charge and is widely used across the industry. This guide walks you through installing and updating MySQL Community on Windows, macOS, and Linux (either through the native repositories or MySQL’s own repositories).

      When installing MySQL, you can either install MySQL Server or MySQL client utilities. Installing the entire MySQL Server software is the most common option. This allows you to run a full database server on your system. It also installs all of the client utilities that you might need when working with any MySQL instances (a locally installed one or one on a remote system). If you want to reduce disk usage or know you only need the client utilities, you can install the MySQL client package. Alternatively, consider installing and using the
      MySQL Shell.

      Currently, there are two primary MySQL releases to consider: MySQL 5.7 and MySQL 8.0. Both are still receiving support and updates (until October 2023 and April 2026 respectively). You should likely install MySQL 8.0 unless your application does not yet support it.

      Note

      For additional instructions on installing MySQL on any supported operating system, see the
      Installing and Upgrading MySQL guide in the official documentation.

      Before You Begin

      • Consider other deployment options, such as fully managed solutions or automated installations.

      • Check to see if MySQL is already installed on your system. To determine if MySQL is already installed, run the following command:

        mysql --version
        

        The above command should inform you which version you are using. If this command is not found, continue with the installation steps below. If the installed version differs from the release you want to use, consider first uninstalling it and then continuing with the instructions below.

      Note

      The steps in this guide are written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, see the
      Linux Users and Groups guide.

      Installing MySQL on Windows

      1. Open a web browser and navigate to the
        MySQL Installer Downloads page. By default, the latest version of MySQL is displayed. You can also view the installer files for
        8.0 or
        5.7 directly. Alternatively, you can navigate to the Archives tab and select any MySQL release and version you wish.

      2. Select your operating system version, click the Download link corresponding with the package you’d like to install, and then click the No thanks, just start my download link. The file should now start downloading.

      3. Open the downloaded file and follow the prompts to install MySQL on your system.

      Installing MySQL on macOS

      1. Open a web browser and navigate to the
        MySQL Community Server Downloads page. By default, the latest version of MySQL is displayed. You can also view the installer files for
        8.0 or
        5.7 directly. Alternatively, you can navigate to the Archives tab and select any MySQL release and version you wish.

      2. Select your operating system version, click the Download link corresponding with the package you’d like to install, and then click the No thanks, just start my download link. The file should now start downloading.

      3. Open the downloaded file and follow the prompts to install MySQL on your system.

      Installing MySQL on Linux: Native Repositories

      One of the fastest ways to quickly install MySQL on most common Linux distributions is to use the distribution’s default/native repositories. For greater control over the release and version that’s installed, and to get the latest versions faster, you may want to consider using
      MySQL’s own YUM or APT repositories.

      CentOS Stream 8 (and 9), CentOS/RHEL 8 (and 9)

      sudo dnf upgrade && sudo dnf install mysql-server
      

      CentOS/RHEL 7

      MySQL is not available through CentOS 7’s native repositories (see
      CentOS 7 Packages list). Installing the mysql package actually installs the mariadb package. While MariaDB can be used as a drop-in replacement in some cases, it may be preferable to install MySQL through the
      MySQL YUM repository.

      sudo yum update && sudo yum install mariadb-server
      

      Debian

      MySQL is not available through Debian’s native repositories. Instead, Debian includes MariaDB. While MariaDB can be used as a drop-in replacement in some cases, it may be preferable to install MySQL through the
      MySQL APT repository.

      sudo apt update && sudo apt install mariadb-server
      

      Fedora

      sudo dnf update && sudo dnf install mysql-community-server
      

      Ubuntu

      sudo apt update && sudo apt install mysql-server
      

      Replace mysql-server with one of the available packages below. If no version is specified in the package name, the default version is installed.

      • MySQL Server packages: mysql-server

        Target a specific version with mysql-server-5.7 or mysql-server-8.0. See
        Ubuntu Package Search for more.

      • MySQL Client packages: mysql-client

        Target a specific version with mysql-client-5.7 or mysql-client-8.0. See
        Ubuntu Package Search for more.

      Installing MySQL on Linux: MySQL’s Repositories

      Using MySQL’s own repositories provides the latest MySQL versions faster than most native repositories. It also allows you more control over the version that is installed.

      Ubuntu and Debian (APT Repository)

      1. Download the release package for your distribution. Currently, all compatible distributions are combined into a single release package.

        wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
        

        If you’d like to download the latest version of this file or to select a different distribution, visit the
        MySQL APT Repository Downloads page. To obtain the URL for the file, click the Downloads button next to the package you wish to download, right click on the No thanks, just start my download link, and select Copy Link Address (or similar).

      2. Install the downloaded release package. If you downloaded a different file than featured in the previous step, adjust the filename as needed.

        sudo dpkg -i ./mysql-apt-config_0.8.22-1_all.deb
        
      3. The repository configuration tool should automatically start. If not, you can run it using the following command:

        sudo dpkg-reconfigure mysql-apt-config
        
      4. Within the configuration tool, you can select from the options below to adjust how the repository is configured in your system:

        • MySQL Server & Cluster: Select mysql to add MySQL Server packages, mysql-cluster to add the
          MySQL NDB Cluster, or None to forgo adding either option.

        • MySQL Tools & Connectors: When enabled, this option adds all of the additional tools and utilities included with the MySQL software.

        • MySQL Preview Packages: Leave this option as disabled in production, though non-production environments can enable this to test unreleased features and products.

      5. Run the update command to obtain updated package version and dependency information:

        sudo apt update
        
      6. Install MySQL Server or just the MySQL client tools:

        Additional information about the packages available within MySQL’s APT repository can be found by exploring the repository for your distribution:
        Ubuntu or
        Debian.

      CentOS/RHEL and Fedora (YUM Repository)

      1. Download the release package for your distribution.

        curl -OL [file-url]
        
        • CentOS/RHEL 8: https://dev.mysql.com/get/mysql80-community-release-el8-4.noarch.rpm
        • CentOS/RHEL 7: https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
        • Fedora 35: https://dev.mysql.com/get/mysql80-community-release-fc35-3.noarch.rpm
        • Fedora 34: https://dev.mysql.com/get/mysql80-community-release-fc34-4.noarch.rpm

        If you’d like to download the latest file or to select a different distribution, visit the
        MySQL YUM Repository Downloads page. To obtain the URL for the desired file, click the Downloads button next to the package you wish to download, right click on the No thanks, just start my download link, and select Copy Link Address (or similar).

      2. Install the downloaded release package, replacing [filename] with the file you just downloaded.

        sudo yum install [filename]
        

        Once installed, you can view all available packages and all enabled packages by running the commands below:

        yum repolist all | grep mysql
        yum repolist enabled | grep mysql
        
      3. By default, the MySQL 8.0 release will be installed. To switch this to MySQL 5.7 or any other available release, run the following commands:

        • CentOS Stream 8 (and 9), CentOS/RHEL 8 (and 9)

          sudo dnf config-manager --disable mysql80-community
          sudo dnf config-manager --enable mysql57-community
          
        • CentOS/RHEL 7:

          sudo yum-config-manager --disable mysql80-community
          sudo yum-config-manager --enable mysql57-community
          
      4. Within CentOS/RHEL 8 distributions, disable the default MySQL module.

        sudo dnf module disable mysql
        
      5. Install MySQL Server or just the MySQL client tools:

        Additional information about the packages available within MySQL’s YUM repository can be found by
        exploring the repository.

      More Information

      You may wish to consult the following resources for additional information
      on this topic. While these are provided in the hope that they will be
      useful, please note that we cannot vouch for the accuracy or timeliness of
      externally hosted materials.



      Source link

      Installing the Linode CCM on an Unmanaged Kubernetes Cluster – A Tutorial


      Updated by Linode Contributed by Linode

      What is the Linode CCM?

      The Linode Cloud Controller Manager (CCM) provides a way for Kubernetes clusters to access additional Linode services. Linode’s CCM provides access to Linode’s load balancing service, Linode NodeBalancers.

      NodeBalancers provide your Kubernetes cluster with a reliable way of exposing resources to the public internet. The Linode CCM handles the creation and deletion of the NodeBalancer, and, along with other Master Plane components, correctly identifies the resources, and their networking, that the NodeBalancer will route traffic to. Whenever a Kubernetes Service of the LoadBalancer type is created, your Kubernetes cluster will create a Linode NodeBalancer service with the help of the Linode CCM.

      Note

      This guide will show you how to manually install the Linode CCM on an unmanaged Kubernetes cluster. This guide exists to support special use cases. For example, if you would like to experiment with various elements of a Kubernetes control plane.

      If you would like to use Kubernetes for production scenarios and make use of Linode NodeBalancers to expose your cluster’s resources, it is recommended that you use the Linode Kubernetes Engine to deploy your cluster. An LKE cluster’s control plane has the Linode CCM preinstalled and does not require any of the steps included in this guide.

      Similarly, if you would like to deploy an unmanaged Kubernetes cluster on Linode, the best way to accomplish that is using Terraform and the Linode K8s module. The Linode K8s module will also include the Linode CCM preinstalled on the Kubernetes master’s control plane and does not require any of the steps included in this guide.

      If you have used the Linode Kubernetes Engine (LKE) or the Linode Terraform K8s module to deploy your cluster, you should instead refer to the Getting Started with Load Balancing on a Linode Kubernetes Engine (LKE) Cluster guide for steps on adding and configuring NodeBalancers on your Kubernetes cluster.

      In this Guide

      You will manually install the Linode CCM on your unmanaged Kubernetes cluster. This will include:

      Before You Begin

      1. Deploy a new unmanaged Kubernetes cluster. You can deploy an unmanaged Kubernetes cluster on Linode by following the Getting Started with Kubernetes: Use kubeadm to Deploy a Cluster on Linode

        Note

        It is recommended that you install the Linode CCM on a new Kubernetes cluster, as there are a number of issues that prevent the CCM from running on Nodes that are in the “Ready” state.

      2. Ensure you have kubectl installed on your local computer and you can access your Kubernetes cluster with it.

      3. Install Git on your local computer.

      4. Generate a Linode APIv4 token.

      Running the Linode Cloud Controller Manager

      Update Your Cluster Configuration

      In order to run the Linode Cloud Controller Manager:

      • You must start kubelet with the --cloud-provider=external flag.
      • kube-apiserver and kube-controller-manager must NOT supply the --cloud-provider flag.

      These configurations will change the behavior of your cluster and how it interacts with its Nodes. For more details, visit the upstream Cloud Controller documentation.

      Install the Linode CCM

      The Linode CCM’s GitHub repository provides a helper script that creates a Kubernetes manifest file that you can use to install the CCM on your cluster. These steps should be run on your local computer and were tested on a macOS.

      Note

      You will need your Linode APIv4 token to complete the steps in this section.
      1. Clone the Linode CCM’s GitHub repository.

        git clone [email protected]:linode/linode-cloud-controller-manager.git
        
      2. Move into the CCM repository’s deploy directory.

        cd linode-cloud-controller-manager/deploy/
        
      3. Run the generate-manifest.sh script. Ensure you replace $LINODE_API_TOKEN with your own Linode APIv4 token and us-east with the Linode region where your cluster resides. To view a list of regions, you can use the Linode CLI, or you can view the Regions API endpoint.

        ./generate-manifest.sh $LINODE_API_TOKEN us-east
        

        After running the script, you should have a new manifest file in the repo’s deploy directory, ccm-linode.yaml.

      4. Apply the manifest file to your cluster in order to install the Linode CCM and the required supporting resources.

        kubectl create -f ccm-linode.yaml
        

        Note

        You can create your own ccm-linode.yaml manifest file by editing the contents of the ccm-linode-template.yaml file and changing the values of the data.apiToken and data.region fields with your own desired values. This template file is located in the deploy directory of the Linode CCM repository.

      Updating the Linode CCM

      The easiest way to update the Linode CCM is to edit the DaemonSet that creates the Linode CCM Pod. To do so:

      1. Run the edit command to make changes to the CCM Daemonset.

        kubectl edit ds -n kube-system ccm-linode
        
      2. The CCM Daemonset manifest will appear in vim. Press i to enter insert mode. Navigate to spec.template.spec.image and change the field’s value to the desired version tag. For instance, if you had the following image:

        image: linode/linode-cloud-controller-manager:v0.2.2
        

        You could update the image to v0.2.3 by changing the image tag:

        image: linode/linode-cloud-controller-manager:v0.2.3
        

        For a complete list of CCM version tags, visit the CCM DockerHub page.

        Caution

        The CCM Daemonset manifest may list latest as the image version tag. This may or may not be pointed at the latest version. To ensure the latest version, it is recommended to first check the CCM DockerHub page, then use the most recent release.
      3. Press escape to exit insert mode, then type :wq and press enter to save your changes. A new Pod will be created with the new image, and the old Pod will be deleted.

      Next Steps

      Now that you have the Linode CCM installed on your Kubernetes cluster, you can learn how to add and configure Linode NodeBalancers on your cluster.

      This guide is published under a CC BY-ND 4.0 license.



      Source link