One place for hosting & domains

      MariaDB

      How To Reset Your MySQL or MariaDB Root Password on Ubuntu 18.04


      Introduction

      Forgetting passwords happens to the best of us. If you forget or lose the root password to your MySQL or MariaDB database, you can still gain access and reset the password if you have access to the server and a user account with sudo privileges.

      Note: On fresh Ubuntu 18.04 installations, the default MySQL or MariaDB configuration usually allows you to access the database (with full administrative privileges) without providing a password as long as you make the connection from the system’s root account. In this scenario it may not be necessary to reset the password. Before you proceed with resetting your database root password, try to access the database with the sudo mysql command. If this results in an access denied error, follow the steps in this tutorial.

      This tutorial demonstrates how to reset the root password for MySQL and MariaDB databases installed with the apt package manager on Ubuntu 18.04. The procedure for changing the root password differs depending on whether you have MySQL or MariaDB installed, as well as the default systemd configuration that ships with the distribution or packages from other vendors. While the instructions in this tutorial may work with other system or database server versions, they have been tested specifically with Ubuntu 18.04 and distribution-supplied packages.

      Prerequisites

      To recover your MySQL or MariaDB root password, you will need:

      • Access to the Ubuntu 18.04 server running MySQL or MariaDB with a sudo user or other way of accessing the server with root privileges. In order to try out the recovery methods in this tutorial without affecting your production server, use the initial server setup tutorial to create a test server with a regular, non-root user with sudo privileges. Then install MySQL following How to install MySQL on Ubuntu 18.04.

      Step 1 — Identifying the Database Version and Stopping the Server

      Ubuntu 18.04 runs either MySQL or MariaDB, a popular drop-in replacement which is fully compatible with MySQL. You’ll need to use different commands to recover the root password depending on which of these you have installed, so follow the steps in this section to determine which database server you’re running.

      Check your version with the following command:

      If you're running MariaDB, you'll see "MariaDB" preceded by the version number in the output:

      MariaDB output

      mysql Ver 15.1 Distrib 10.1.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

      You'll see output like this if you're running MySQL:

      MySQL output

      mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper

      Make note of which database, as this determines the appropriate commands to follow in the rest of this tutorial.

      In order to change the root password, you'll need to shut down the database server. If you're running MariaDB, you can do so with the following command:

      • sudo systemctl stop mariadb

      For MySQL, shut down the database server by running:

      • sudo systemctl stop mysql

      With the database stopped, you can restart it in safe mode to reset the root password.

      Step 2 — Restarting the Database Server Without Permission Checks

      Running MySQL and MariaDB without permission checking allows accessing the database command line with root privileges without providing a valid password. To do this, you need to stop the database from loading the grant tables, which store user privilege information. Since this is a bit of a security risk, you may also want to disable networking to prevent other clients from connecting to the temporarily vulnerable server.

      Depending on which database server you've installed, the way of starting the server without loading the grant tables differs.

      Configuring MariaDB to Start Without Grant Tables

      In order to start the MariaDB server without the grant tables, we'll use the systemd unit file to set additional parameters for the MariaDB server daemon.

      Execute the following command which sets the MYSQLD_OPTS environment variable used by MariaDB upon startup. The --skip-grant-tables and --skip-networking options tell MariaDB to start up without loading the grant tables or networking features:

      • sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"

      Then start the MariaDB server:

      • sudo systemctl start mariadb

      This command won't produce any output, but it will restart the database server, taking into account the new environment variable settings.

      You can ensure it started with sudo systemctl status mariadb.

      Now you should be able to connect to the database as the MariaDB root user without supplying a password:

      You'll immediately see a database shell prompt:

      MariaDB prompt

      Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]>

      Now that you have access to the database server, you can change the root password as shown in Step 3.

      Configuring MySQL to Start Without Grant Tables

      In order to start the MySQL server without its grant tables, you'll alter the systemd configuration for MySQL to pass additional command-line parameters to the server upon startup.

      To do this, execute the following command:

      • sudo systemctl edit mysql

      This command will open a new file in the nano editor, which you'll use to edit MySQL's service overrides. These change the default service parameters for MySQL. This file will be empty, so add the following content:

      MySQL service overrides

      [Service]
      ExecStart=
      ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking
      

      The first ExecStart statement clears the default value, while the second one provides systemd with the new startup command including parameters to disable loading the grant tables and networking capabilities.

      Press CTRL-x to exit the file, then Y to save the changes that you made, then ENTER to confirm the file name.

      Reload the systemd configuration to apply these changes:

      • sudo systemctl daemon-reload

      Now start the MySQL server:

      • sudo systemctl start mysql

      The command will show no output, but the database server will start. The grant tables and networking will not be enabled.

      Connect to the database as the root user:

      You'll immediately see a database shell prompt:

      MySQL prompt

      Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>

      Now that you have access to the server, you can change the root password.

      Step 3 — Changing the Root Password

      The database server is now running in a limited mode; the grant tables are not loaded and there's no networking support enabled. This lets you access the server without providing a password, but it prohibits you from executing commands that alter data. To reset the root password, you must load the grant tables now that you've gained access to the server.

      Tell the database server to reload the grant tables by issuing the FLUSH PRIVILEGES command.

      You can now change the root password. The method you use depends on whether you are using MariaDB or MySQL.

      Changing the MariaDB Password

      If you are using MariaDB, execute the following statement to set the password for the root account, making sure to replace new_password with a strong new password that you'll remember.

      • UPDATE mysql.user SET password = PASSWORD('new_password') WHERE user = 'root';

      You'll see this output indicating that the password changed:

      Output

      Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

      MariaDB allows using custom authentication mechanisms, so execute the following two statements to make sure MariaDB will use its default authentication mechanism for the new password you assigned to the root account:

      • UPDATE mysql.user SET authentication_string = '' WHERE user = 'root';
      • UPDATE mysql.user SET plugin = '' WHERE user = 'root';

      You'll see the following output for each statement:

      Output

      Query OK, 0 rows affected (0.01 sec) Rows matched: 1 Changed: 0 Warnings: 0

      The password is now changed. Type exit to exit the MariaDB console and proceed to Step 4 to restart the database server in normal mode.

      Changing the MySQL Password

      For MySQL, execute the following statement to change the root user's password, replacing new_password with a strong password you'll remember:

      • UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE user = 'root';

      You'll see this output indicating the password was changed successfully:

      Output

      Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

      MySQL allows using custom authentication mechanisms, so execute the following statement to tell MySQL touse its default authentication mechanism to authenticate the root user using the new password:

      • UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root';

      You'll see output similar to the previous command:

      Output

      Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

      The password is now changed. Exit the MySQL console by typing exit.

      Let's restart the database in normal operational mode.

      Step 4 — Reverting Your Database Server to Normal Settings

      In order to restart the database server in its normal mode, you have to revert the changes you made so that networking is enabled and the grant tables are loaded. Again, the method you use depends on whether you used MariaDB or MySQL.

      For MariaDB, unset the MYSQLD_OPTS environment variable you set previously:

      • sudo systemctl unset-environment MYSQLD_OPTS

      Then, restart the service using systemctl:

      • sudo systemctl restart mariadb

      For MySQL, remove the modified systemd configuration:

      • sudo systemctl revert mysql

      You'll see output similar to the following:

      Output

      Removed /etc/systemd/system/mysql.service.d/override.conf. Removed /etc/systemd/system/mysql.service.d.

      Then, reload the systemd configuration to apply the changes:

      • sudo systemctl daemon-reload

      Finally, restart the service:

      • sudo systemctl restart mysql

      The database is now restarted and is back to its normal state. Confirm that the new password works by logging in as the root user with a password:

      You'll be prompted for a password. Enter your new password and you'll gain access to the database prompt as expected.

      Conclusion

      You have restored administrative access to the MySQL or MariaDB server. Make sure the new password you chose is strong and secure and keep it in a safe place.

      For more information on user management, authentication mechanisms, or ways of resetting database password for other version of MySQL or MariaDB, please refer to the official MySQL documentation or MariaDB documentation.



      Source link

      How To Install Linux, Apache, MariaDB, PHP (LAMP) stack on Debian 9


      Introduction

      A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MariaDB database, and dynamic content is processed by PHP.

      In this guide, we will install a LAMP stack on a Debian 9 server.

      Prerequisites

      In order to complete this tutorial, you will need to have a Debian 9 server with a non-root sudo-enabled user account and a basic firewall. This can be configured using our initial server setup guide for Debian 9.

      Step 1 — Installing Apache and Updating the Firewall

      The Apache web server is among the most popular web servers in the world. It’s well-documented and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website.

      Install Apache using Debian’s package manager, apt:

      • sudo apt update
      • sudo apt install apache2

      Since this is a sudo command, these operations are executed with root privileges. It will ask you for your regular user’s password to verify your intentions.

      Once you’ve entered your password, apt will tell you which packages it plans to install and how much extra disk space they’ll take up. Press Y and hit ENTER to continue, and the installation will proceed.

      Next, assuming that you have followed the initial server setup instructions by installing and enabling the UFW firewall, make sure that your firewall allows HTTP and HTTPS traffic.

      When installed on Debian 9, UFW comes loaded with app profiles which you can use to tweak your firewall settings. View the full list of application profiles by running:

      The WWW profiles are used to manage ports used by web servers:

      Output

      Available applications: . . . WWW WWW Cache WWW Full WWW Secure . . .

      If you inspect the WWW Full profile, it shows that it enables traffic to ports 80 and 443:

      • sudo ufw app info "WWW Full"

      Output

      Profile: WWW Full Title: Web Server (HTTP,HTTPS) Description: Web Server (HTTP,HTTPS) Ports: 80,443/tcp

      Allow incoming HTTP and HTTPS traffic for this profile:

      • sudo ufw allow in “WWW Full”

      You can do a spot check right away to verify that everything went as planned by visiting your server's public IP address in your web browser:

      http://your_server_ip
      

      You will see the default Debian 9 Apache web page, which is there for informational and testing purposes. It should look something like this:

      Debian 9 Apache default

      If you see this page, then your web server is now correctly installed and accessible through your firewall.

      If you do not know what your server's public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH.

      There are a few different ways to do this from the command line. First, you could use the iproute2 tools to get your IP address by typing this:

      • ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's//.*$//'

      This will give you two or three lines back. They are all correct addresses, but your computer may only be able to use one of them, so feel free to try each one.

      An alternative method is to use the curl utility to contact an outside party to tell you how it sees your server. This is done by asking a specific server what your IP address is:

      • sudo apt install curl
      • curl http://icanhazip.com

      Regardless of the method you use to get your IP address, type it into your web browser's address bar to view the default Apache page.

      Step 2 — Installing MariaDB

      Now that you have your web server up and running, it is time to install MariaDB. MariaDB is a database management system. Basically, it will organize and provide access to databases where your site can store information.

      MariaDB is a community-built fork of MySQL. In Debian 9, the default MySQL server is MariaDB 10.1, and the mysql-server package, which is normally used to install MySQL, is a transitional package that will actually install MariaDB. However, it’s recommended that you install MariaDB using the program’s actual package, mariadb-server.

      Again, use apt to acquire and install this software:

      • sudo apt install mariadb-server

      Note: In this case, you do not have to run sudo apt update prior to the command. This is because you recently ran it in the commands above to install Apache, and the package index on your computer should already be up-to-date.

      This command, too, will show you a list of the packages that will be installed, along with the amount of disk space they'll take up. Enter Y to continue.

      When the installation is complete, run a simple security script that comes pre-installed with MariaDB which will remove some insecure default settings and lock down access to your database system. Start the interactive script by running:

      • sudo mysql_secure_installation

      This will take you through a series of prompts where you can make some changes to your MariaDB installation’s security options. The first prompt will ask you to enter the current database root password. This is an administrative account in MariaDB that has increased privileges. Think of it as being similar to the root account for the server itself (although the one you are configuring now is a MariaDB-specific account). Because you just installed MariaDB and haven’t made any configuration changes yet, this password will be blank, so just press ENTER at the prompt.

      The next prompt asks you whether you'd like to set up a database root password. Type N and then press ENTER. In Debian, the root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Doing so would make it possible for a package update to break the database system by removing access to the administrative account. Later, we will cover how to optionally set up an additional administrative account for password access if socket authentication is not appropriate for your use case.

      From there, you can press Y and then ENTER to accept the defaults for all the subsequent questions. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MariaDB immediately respects the changes you have made.

      In new installs on Debian systems, the root MariaDB user is set to authenticate using the unix_socket plugin by default rather than with a password. This allows for some greater security and usability in many cases, but it can also complicate things when you need to allow an external program (e.g., phpMyAdmin) administrative rights.

      Because the server uses the root account for tasks like log rotation and starting and stopping the server, it is best not to change the root account's authentication details. Changing the account credentials in the /etc/mysql/debian.cnf may work initially, but package updates could potentially overwrite those changes. Instead of modifying the root account, the package maintainers recommend creating a separate administrative account if you need to set up password-based access.

      To do so, we will be creating a new account called admin with the same capabilities as the root account, but configured for password authentication. To do this, open up the MariaDB prompt from your terminal:

      Now, we can create a new user with root privileges and password-based access. Change the username and password to match your preferences:

      • GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

      Flush the privileges to ensure that they are saved and available in the current session:

      Following this, exit the MariaDB shell:

      Now, any time you want to access your database as your new administrative user, you’ll need to authenticate as that user with the password you just set using the following command:

      At this point, your database system is set up and you can move on to installing PHP, the final component of the LAMP stack.

      Step 3 — Installing PHP

      PHP is the component of your setup that will process code to display dynamic content. It can run scripts, connect to your MariaDB databases to get information, and hand the processed content over to your web server to display.

      Once again, leverage the apt system to install PHP. In addition, include some helper packages this time so that PHP code can run under the Apache server and talk to your MariaDB database:

      • sudo apt install php libapache2-mod-php php-mysql

      This should install PHP without any problems. We'll test this in a moment.

      In most cases, you will want to modify the way that Apache serves files when a directory is requested. Currently, if a user requests a directory from the server, Apache will first look for a file called index.html. We want to tell the web server to prefer PHP files over others, so make Apache look for an index.php file first.

      To do this, type this command to open the dir.conf file in a text editor with root privileges:

      • sudo nano /etc/apache2/mods-enabled/dir.conf

      It will look like this:

      /etc/apache2/mods-enabled/dir.conf

      <IfModule mod_dir.c>
          DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
      </IfModule>
      

      Move the PHP index file (highlighted above) to the first position after the DirectoryIndex specification, like this:

      /etc/apache2/mods-enabled/dir.conf

      <IfModule mod_dir.c>
          DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
      </IfModule>
      

      When you are finished, save and close the file by pressing CTRL+X. Confirm the save by typing Y and then hit ENTER to verify the file save location.

      After this, restart the Apache web server in order for your changes to be recognized. Do this by typing this:

      • sudo systemctl restart apache2

      You can also check on the status of the apache2 service using systemctl:

      • sudo systemctl status apache2

      Sample Output

      ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2018-09-04 18:23:03 UTC; 9s ago Process: 22209 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS) Process: 22216 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 22221 (apache2) Tasks: 6 (limit: 4915) CGroup: /system.slice/apache2.service ├─22221 /usr/sbin/apache2 -k start ├─22222 /usr/sbin/apache2 -k start ├─22223 /usr/sbin/apache2 -k start ├─22224 /usr/sbin/apache2 -k start ├─22225 /usr/sbin/apache2 -k start └─22226 /usr/sbin/apache2 -k start

      To enhance the functionality of PHP, you have the option to install some additional modules. To see the available options for PHP modules and libraries, pipe the results of apt search into less, a pager which lets you scroll through the output of other commands:

      Use the arrow keys to scroll up and down, and press Q to quit.

      The results are all optional components that you can install. It will give you a short description for each:

      Output

      Sorting... Full Text Search... bandwidthd-pgsql/stable 2.0.1+cvs20090917-10 amd64 Tracks usage of TCP/IP and builds html files with graphs bluefish/stable 2.2.9-1+b1 amd64 advanced Gtk+ text editor for web and software development cacti/stable 0.8.8h+ds1-10 all web interface for graphing of monitoring systems cakephp-scripts/stable 2.8.5-1 all rapid application development framework for PHP (scripts) ganglia-webfrontend/stable 3.6.1-3 all cluster monitoring toolkit - web front-end haserl/stable 0.9.35-2+b1 amd64 CGI scripting program for embedded environments kdevelop-php-docs/stable 5.0.3-1 all transitional package for kdevelop-php kdevelop-php-docs-l10n/stable 5.0.3-1 all transitional package for kdevelop-php-l10n … :

      To learn more about what each module does, you could search the internet for more information about them. Alternatively, look at the long description of the package by typing:

      There will be a lot of output, with one field called Description which will have a longer explanation of the functionality that the module provides.

      For example, to find out what the php-cli module does, you could type this:

      Along with a large amount of other information, you'll find something that looks like this:

      Output

      … Description: command-line interpreter for the PHP scripting language (default) This package provides the /usr/bin/php command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks. . PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0). …

      If, after researching, you decide you would like to install a package, you can do so by using the apt install command like you have been doing for the other software.

      If you decided that php-cli is something that you need, you could type:

      If you want to install more than one module, you can do that by listing each one, separated by a space, following the apt install command, like this:

      • sudo apt install package1 package2 ...

      At this point, your LAMP stack is installed and configured. Before making any more changes or deploying an application, though, it would be helpful to proactively test out your PHP configuration in case there are any issues that should be addressed.

      Step 4 — Testing PHP Processing on your Web Server

      In order to test that your system is configured properly for PHP, create a very basic PHP script called info.php. In order for Apache to find this file and serve it correctly, it must be saved to a very specific directory called the web root.

      In Debian 9, this directory is located at /var/www/html/. Create the file at that location by running:

      • sudo nano /var/www/html/info.php

      This will open a blank file. Add the following text, which is valid PHP code, inside the file:

      /var/www/html/info.php

      <?php
      phpinfo();
      ?>
      

      When you are finished, save and close the file.

      Now you can test whether your web server is able to correctly display content generated by this PHP script. To try this out, visit this page in your web browser. You'll need your server's public IP address again.

      The address you will want to visit is:

      http://your_server_ip/info.php
      

      The page that you come to should look something like this:

      Debian 9 default PHP info

      This page provides some basic information about your server from the perspective of PHP. It is useful for debugging and to ensure that your settings are being applied correctly.

      If you can see this page in your browser, then your PHP is working as expected.

      You probably want to remove this file after this test because it could actually give information about your server to unauthorized users. To do this, run the following command:

      • sudo rm /var/www/html/info.php

      You can always recreate this page if you need to access the information again later.

      Conclusion

      Now that you have a LAMP stack installed, you have many choices for what to do next. Basically, you've installed a platform that will allow you to install most kinds of websites and web software on your server.



      Source link

      How To Install MariaDB on Debian 9


      Introduction

      MariaDB is an open-source database management system, commonly installed in place of MySQL as part of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data. MariaDB was forked from MySQL in 2009 due to licensing concerns.

      The short version of the installation is simple: update your package index, install the mariadb-server package (which points to MariaDB), and then run the included security script.

      • sudo apt update
      • sudo apt install mariadb-server
      • sudo mysql_secure_installation

      This tutorial will explain how to install MariaDB version 10.1 on a Debian 9 server.

      Prerequisites

      To follow this tutorial, you will need:

      Step 1 — Installing MariaDB

      On Debian 9, MariaDB version 10.1 is included in the APT package repositories by default. It is marked as the default MySQL variant by the Debian MySQL/MariaDB packaging team.

      To install it, update the package index on your server with apt:

      Then install the package:

      • sudo apt install mariadb-server

      This will install MariaDB, but will not prompt you to set a password or make any other configuration changes. Because this leaves your installation of MariaDB insecure, we will address this next.

      Step 2 — Configuring MariaDB

      For fresh installations, you'll want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users.

      Run the security script:

      • sudo mysql_secure_installation

      This will take you through a series of prompts where you can make some changes to your MariaDB installation’s security options. The first prompt will ask you to enter the current database root password. Since we have not set one up yet, press ENTER to indicate "none".

      The next prompt asks you whether you'd like to set up a database root password. Type N and then press ENTER. In Debian, the root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Doing so would make it possible for a package update to break the database system by removing access to the administrative account. Later, we will cover how to optionally set up an additional administrative account for password access if socket authentication is not appropriate for your use case.

      From there, you can press Y and then ENTER to accept the defaults for all the subsequent questions. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MariaDB immediately respects the changes you have made.

      Step 3 — (Optional) Adjusting User Authentication and Privileges

      In Debian systems running MariaDB 10.1, the root MariaDB user is set to authenticate using the unix_socket plugin by default rather than with a password. This allows for some greater security and usability in many cases, but it can also complicate things when you need to allow an external program (e.g., phpMyAdmin) administrative rights.

      Because the server uses the root account for tasks like log rotation and starting and stopping the server, it is best not to change the root account's authentication details. Changing the account credentials in the /etc/mysql/debian.cnf may work initially, but package updates could potentially overwrite those changes. Instead of modifying the root account, the package maintainers recommend creating a separate administrative account if you need to set up password-based access.

      To do so, we will be creating a new account called admin with the same capabilities as the root account, but configured for password authentication. To do this, open up the MariaDB prompt from your terminal:

      Now, we can create a new user with root privileges and password-based access. Change the username and password to match your preferences:

      • GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

      Flush the privileges to ensure that they are saved and available in the current session:

      Following this, exit the MariaDB shell:

      Finally, let's test the MariaDB installation.

      Step 4 — Testing MariaDB

      When installed from the default repositories, MariaDB should start running automatically. To test this, check its status.

      • sudo systemctl status mariadb

      You'll see output similar to the following:

      Output

      ● mariadb.service - MariaDB database server
         Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
         Active: active (running) since Tue 2018-09-04 16:22:47 UTC; 2h 35min ago
        Process: 15596 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSIT
        Process: 15594 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
        Process: 15478 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   
        Process: 15474 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITI
        Process: 15471 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysql
       Main PID: 15567 (mysqld)
         Status: "Taking your SQL requests now..."
          Tasks: 27 (limit: 4915)
         CGroup: /system.slice/mariadb.service
                 └─15567 /usr/sbin/mysqld
      
      Sep 04 16:22:45 deb-mysql1 systemd[1]: Starting MariaDB database server...
      Sep 04 16:22:46 deb-mysql1 mysqld[15567]: 2018-09-04 16:22:46 140183374869056 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-0+deb9u1) starting as process 15567 ...
      Sep 04 16:22:47 deb-mysql1 systemd[1]: Started MariaDB database server.
      

      If MariaDB isn't running, you can start it with sudo systemctl start mariadb.

      For an additional check, you can try connecting to the database using the mysqladmin tool, which is a client that lets you run administrative commands. For example, this command says to connect to MariaDB as root and return the version using the Unix socket:

      You should see output similar to this:

      Output

      mysqladmin Ver 9.1 Distrib 10.1.26-MariaDB, for debian-linux-gnu on x86_64 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Server version 10.1.26-MariaDB-0+deb9u1 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/run/mysqld/mysqld.sock Uptime: 2 hours 44 min 46 sec Threads: 1 Questions: 36 Slow queries: 0 Opens: 21 Flush tables: 1 Open tables: 15 Queries per second avg: 0.003

      If you configured a separate administrative user with password authentication, you could perform the same operation by typing:

      • mysqladmin -u admin -p version

      This means MariaDB is up and running and that your user is able to authenticate successfully.

      Conclusion

      You now have a basic MariaDB setup installed on your server. Here are a few examples of next steps you can take:



      Source link