Deploying MySQL/MariaDB through the Linode Marketplace

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

MySQL is an open-source database management system that uses a relational database and SQL (Structured Query Language) to manage its data. In Debian 9, MySQL is replaced with MariaDB as the default database system. MariaDB is an open-source, multi-threaded relational database management system, backward compatible replacement for MySQL. It is maintained and developed by the MariaDB Foundation.

Deploying the MySQL/MariaDB Marketplace App

The Linode Marketplace allows you to easily deploy software on a Linode using the Linode Cloud Manager.

  1. Log in to the Cloud Manager and select the Marketplace link from the left navigation menu. This displays the Linode Compute Create page with the Marketplace tab pre-selected.

  2. Under the Select App section, select the app you would like to deploy.

  3. Fill out all required Options for the selected app as well as any desired Advanced Options (which are optional). See the Configuration Options section for details.

  4. Complete the rest of the form as discussed within the Getting Started > Create a Linode.

  5. Click the Create Linode button. Once the Linode has provisioned and has fully powered on, wait for the software installation to complete. If the Linode is powered off or restarted before this time, the software installation will likely fail. To determine if the installation has completed, open the Linode’s Lish console and wait for the system login prompt to appear.

  6. Follow the instructions within the Getting Started After Deployment section.

Software installation should complete within 2-5 minutes after the Linode has finished provisioning.

Configuration Options

MySQL/MariaDB Options

FieldDescription
MySQL or MariaDBSelect which database service you’d like to use. Required.
MySQL Root PasswordThe root password for your MySQL database. Required.
MySQL UserThe user for your MySQLDB database. Required.
MySQL User PasswordThe user password for your MySQL database. Required.
Create DatabaseThe database on your MySQL. Required.
The limited sudo user to be created for the LinodeThis is the limited user account to be created for the Linode. This account has sudo user privileges.
The password for the limited sudo userSet a password for the limited sudo user. The password must meet the complexity strength validation requirements for a strong password. This password can be used to perform any action on your server, similar to root, so make it long, complex, and unique.
The SSH Public Key that will be used to access the LinodeIf you wish to access SSH via Public Key (recommended) rather than by password, enter the public key here.
Disable root access over SSH?Select Yes to block the root account from logging into the server via SSH. Select No to allow the root account to login via SSH.
Your Linode API TokenYour Linode API Token is needed to create DNS records. If this is provided along with the subdomain and domain fields, the installation attempts to create DNS records via the Linode API. If you don’t have a token, but you want the installation to create DNS records, you must create one before continuing.
SubdomainThe subdomain you wish the installer to create a DNS record for during setup. The suggestion given is www. The subdomain should only be provided if you also provide a domain and API Token.
DomainThe domain name where you wish to host your Moodle site. The installer creates a DNS record for this domain during setup if you provide this field along with your API Token.

General Options

For advice on filling out the remaining options on the Create a Linode form, see Getting Started > Create a Linode. That said, some options may be limited or recommended based on this Marketplace App:

  • Supported distributions: Ubuntu 20.04 LTS
  • Recommended plan: Depends on the size of your MySQL database and the amount of traffic you expect.

Getting Started after Deployment

Access MySQL/MariaDB

After MySQL has finished installing, you will be able to access MySQL from the console via ssh with your Linode’s IPv4 address:

  1. SSH into your Linode and create a limited user account.

  2. Log out and log back in as your limited user account.

  3. Update your server:

    sudo apt-get update && apt-get upgrade
    

Using MySQL/MariaDB

The standard tool for interacting with MySQL is the mysql client which installs with the mysql-server package. The MySQL client is used through a terminal.

Root Login

  1. To log in to MySQL as the root user:

    sudo mysql -u root -p
    
  2. When prompted, enter the MySQL root password that you set when launching the Marketplace App. You’ll then be presented with a welcome header and the MySQL prompt as shown below:

    MariaDB [(none)]>
    
  3. To generate a list of commands for the MySQL prompt, enter \h. You’ll then see:

    List of all MySQL commands:
    Note that all text commands must be first on line and end with ';'
    ?         (\?) Synonym for `help'.
    clear     (\c) Clear command.
    connect   (\r) Reconnect to the server. Optional arguments are db and host.
    delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
    edit      (\e) Edit command with $EDITOR.
    ego       (\G) Send command to mysql server, display result vertically.
    exit      (\q) Exit mysql. Same as quit.
    go        (\g) Send command to mysql server.
    help      (\h) Display this help.
    nopager   (\n) Disable pager, print to stdout.
    notee     (\t) Don't write into outfile.
    pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
    print     (\p) Print current command.
    prompt    (\R) Change your mysql prompt.
    quit      (\q) Quit mysql.
    rehash    (\#) Rebuild completion hash.
    source    (\.) Execute an SQL script file. Takes a file name as an argument.
    status    (\s) Get status information from the server.
    system    (\!) Execute a system shell command.
    tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
    use       (\u) Use another database. Takes database name as argument.
    charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
    warnings  (\W) Show warnings after every statement.
    nowarning (\w) Don't show warnings after every statement.
    
    For server side help, type 'help contents'
    
    MariaDB [(none)]>
    
  4. Grant access to the database that you created when launching the Marketplace App for MySQL User. In this example, the database is called webdata, the user webuser, and password of the user is password. Be sure to enter your own password. This should be different from the root password for MySQL:

    GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';
    
  5. To Exit MySQL/MariaDB type:

    exit
    

Create a Sample Table

  1. Log back in as MySQL User that you set when launching the Marketplace App. In the following example the MySQL User is webuser.

    sudo mysql -u webuser -p
    
  2. Create a sample table called customers. This creates a table with a customer ID field of the type INT for integer (auto-incremented for new records, used as the primary key), as well as two fields for storing the customer’s name. In the following example webdata is the database that you created when launching the Marketplace App.

    use webdata;
    create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);
    
  3. To view the contents of the table that you created:

    describe customers;
    

    The output would be:

    +-------------+---------+------+-----+---------+----------------+
    | Field       | Type    | Null | Key | Default | Extra          |
    +-------------+---------+------+-----+---------+----------------+
    | customer_id | int(11) | NO   | PRI | NULL    | auto_increment |
    | first_name  | text    | YES  |     | NULL    |                |
    | last_name   | text    | YES  |     | NULL    |                |
    +-------------+---------+------+-----+---------+----------------+
    
  4. Then exit MySQL/MariaDB.

     exit
    

Next Steps

Note
Currently, Linode does not manage software and systems updates for Marketplace Apps. It is up to the user to perform routine maintenance on software deployed in this fashion.

For more on MySQL/MariaDB, checkout the following guides:

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.

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.