Configuring mysql on linux

How to Install MySQL on Ubuntu 22.04

How to Install MySQL on Ubuntu 22.04 - TechvBlogs

This article will teach how to install, configure and secure MySQL on the ubuntu 22.04 system.

Smit Pipaliya - Author - TechvBlogs

Smit Pipaliya

SSD VPS Servers, Cloud Servers and Cloud Hosting - Vultr.com

What is MySQL?

MySQL is an open-source relational database management system. Its name is a combination of «My», the name of co-founder Michael Widenius’s daughter My, and «SQL», the abbreviation for Structured Query Language.

MySQL is the most popular open-source relational database management system supported by a huge and active community of open-source developers. It is available on over 20 platforms and operating systems, including Linux, Unix, Mac, and Windows.

MySQL is based on Client and Server Architecture. Here, the Client machine requests specific data by querying using Structured Query Language (SQL) and the server responds with the desired output to the client machine after processing the request. MySQL server is multithreaded, multitasking, and is designed to work also on heavy-load production systems. It has both transactional and non-transactional engines.

Among various databases available out there, MySQL is the most popular Database Management System that uses Structured Query Language. The one reason for its popularity is, it is open-source software that is freely available. And MySQL is flexible enough to also work in a dynamic environment. MySQL is faster than other databases and it is platform-independent and compatible with many programming languages like C++, Java, Python, Javascript, PHP, Ruby, etc. The community of MySQL is very large, so if you are stuck anywhere then you can get help from the community.

Features Of MySQL

  1. Open-Source
  2. Quick and Reliable
  3. Scalable
  4. Data Types
  5. Character Sets
  6. Secure
  7. Support for large Databases
  8. Speed
  9. High Flexibility
  10. Allows Rollback
  11. GUI Support and many more

Install, configure and secure MySQL on ubuntu 22.04. This article will teach how to install, configure and secure MySQL on the ubuntu 22.04 system.

How to Install MySQL on Ubuntu 22.04

1. Prerequisites

  • The operating system running Ubuntu 22.04 Linux
  • A root or non-root user with Sudo privileges
  • Has stable internet connection
  • Terminal window / Command line

2. Update Local Repositories

Updating the local package with the apt-get command. Open a terminal window and run the following command:

sudo apt-get update sudo apt-get upgrade

3. Install MySQL Server

Please run the following command as sudo to install MySQL from APT-GET repositories.

sudo apt-get install mysql-server

How to install MySQL On Ubuntu 22.04 - TechvBlogs

The [Y / n] question to continue with the installation may appear during the installation process, press the Y key from the keyboard and hit Enter. This will install MySQL on the system.

Читайте также:  Arch linux steam install

4. Verify MySQL

After the installation, the MySQL server should start automatically. To check if it’s running, run the following command:

5. Managing the MySQL Process

Now that you have your MySQL up and running, let’s go over basic management commands.

To stop your MySQL, run this command:

sudo systemctl stop mysql 

To start your MySQL, run this command:

sudo systemctl start mysql

To status your web server, run this command:

sudo systemctl status mysql

How to install MySQL On Ubuntu 22.04 - TechvBlogs

6. Configure MySQL Server

By default, MySQL lacks many basic and essential security features. Luckily, it comes with an installation script that walks you through the configuration. Use the mysql_secure_installation command:

sudo mysql_secure_installation

You will be asked to configure the VALIDATE PASSWORD PLUGIN which is used to test the strength of the MySQL user’s passwords and improve their security. Type Y to start the Validate Password plugin and you will get the following prompt:

How to install MySQL On Ubuntu 22.04 - TechvBlogs

Enter the number for the password strength and press the Enter key:

How to install MySQL On Ubuntu 22.04 - TechvBlogs

On the next screen, enter and re-enter the password:

How to install MySQL On Ubuntu 22.04 - TechvBlogs

The system will then display the strength of the password you provided and also ask you if you want to continue with the password.

How to install MySQL On Ubuntu 22.04 - TechvBlogs

Type Y for Yes and press Enter.

How to install MySQL On Ubuntu 22.04 - TechvBlogs

Login to MySQL First:

#Output Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.30-0ubuntu0.22.04.1 (Ubuntu) Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

Set Root Password:

Exit MySQL:

Run the Secure Installation Script Again:

sudo mysql_secure_installation

The script will ask these questions:

  1. Enter the password for user root: type your set password and then press ENTER.
  2. Change the password for root? Press N, then ENTER.
  3. Remove anonymous users? Press Y, then ENTER.
  4. Disallow root login remotely? Press Y, then ENTER.
  5. Remove test database and access to it? Press Y, then ENTER.
  6. Reload privilege tables now? Press Y, then ENTER.
#Output Securing the MySQL server deployment. Enter password for user root: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : N . skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y - Dropping test database. Success. - Removing privileges on test database. Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y Success. All done!

7. Log into Mysql And Configuring

Now, when all is set, let’s log in to MySQL with the root user. In the terminal, run the following command:

Читайте также:  Dbeaver linux 32 bit

To check which authentication method each MySQL user uses, run the following command:

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

Change the authentication method from auth_socket to mysql_native_password. You can do that by running the following command:

mysql> ALTER USER ''@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_STRONG_PASSWORD';

After executing the ALTER USER command, run the following command:

Now, if you recheck the authentication method for your MySQL user accounts using the following command, you see that your root user is now using the mysql_native_password plugin for authentication:

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

Thank you for reading this blog.

If you want to manage your VPS / VM Server without touching the command line go and Checkout this link. ServerAvatar allows you to quickly set up WordPress or Custom PHP websites on VPS / VM in a matter of minutes. You can host multiple websites on a single VPS / VM, configure SSL certificates, and monitor the health of your server without ever touching the command line interface.

If you have any queries or doubts about this topic please feel free to contact us. We will try to reach you.

Источник

Install and Configure MySQL on Ubuntu 22.04

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.

How to Install and Configure MySQL on Ubuntu 22.04

Most business applications require access to data, which in turn makes it important to know how to install and manage a Database Management System (DBMS). There are different types of DBMS, but the most popular is the Relational DBMS (RDBMS) which is based on Structured Query Language (SQL). One of the most popular RDBMS is MySQL. This guide explains how to download, and install MySQL Ubuntu 22.04, and set up important configurations.

Читайте также:  Java server for linux

The Difference Between MySQL and MariaDB

Before we get started, let’s understand the relationship between MySQL and MariaDB through their shared history. MySQL is an open-source RDBMS used for everything from small-scale to large-scale industrial applications. Oracle purchased MySQL in May 1995. However, Oracle’s vision of what MySQL should be fell short of some of MySQL developers’ and users’ expectations. These developers created MariaDB based on the Community Edition of MySQL and released it in October 2009.

MariaDB is touted as a drop-in replacement for MySQL, but there are differences between the two products. A significant number of features present in MariaDB make the move to the RDBMS a one-way process. Especially, when you plan to use the advanced features without using some sort of special tool to help with the transfer. It also pays to know that MySQL and MariaDB vary in functionality. For example, MySQL doesn’t support JSON_EXISTS or JSON_QUERY , and MariaDB lacks support for JSON_TABLE . When it comes to SQL support, MySQL provides superior indexing capabilities, while MariaDB supports sequences. The following table provides a quick overview of the significant differences between the two products:

Feature MySQL MariaDB
Underlying development languages C/C++ C/C++
Maturity Developed in 1995 so it has a long-term existence. The server currently has 8K stars and 3.1 forks on GitHub. Developed in 2009 so it’s less mature, especially given the use of additional development languages. The server currently has 4.4k stars and 1.4k forks on GitHub.
Server Operating Systems FreeBSD, Linux, OS X, Solaris, and Windows Linux and Windows
Compatibility MySQL and MariaDB have different views of JSON support. MySQL uses the Internet Engineering Task Force (IETF) RFC 7159 and RFC 7396 standards for JSON support. Drop-in compatibility with MySQL up to version 5.5. Since then, new features make MariaDB increasingly incompatible with MySQL, so it’s important to verify compatibility before using MariaDB in an existing application.
Linux Distributions that Include as Part of Distribution Unknown Some of the most popular Linux distributions include MariaDB by default: CentOS, Debian, Fedora, OpenSUSE, and Red Hat Enterprise.
Companies Using At least 5,878 companies (not including development firms) currently use MySQL, including Uber, Airbnb, Shopify, Pinterest, Netflix, Amazon, Udemy, and Twitter. The number of verified companies using MariaDB varies, but featured customers include: Samsung, Virgin Media, Red Hat, Nokia, Select Quote, Tock, Walgreens, Pixid, Development Bank of Singapore (DBS), and Whitebox.

Download and Install MySQL Server

The steps in this installation guide are for Ubuntu 22.04 as described at the beginning of the guide. Open a terminal window and log into the system as a user with administrative privileges.

    Check for any pending updates, with the below command. A message displays at the end, with the number of packages that need to be upgraded.

Источник

Оцените статью
Adblock
detector