# MySQL on Linux

### 1. Install

### CentOS Stream *9:*

```
sudo dnf install mysql-server -y
```

Enable and start MySQL service:

```
sudo systemctl restart mysqld.service
sudo systemctl enable mysqld.service
```

### *Ubuntu*&#x20;

```
$ sudo apt install mysql-server -y
```

### 2.   Change the authentication parameters:

```
sudo mysql 
```

run command in mysql console:

```

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '<mysql_root_password>';
```

Сhange `<mysql_root_password>` to a strong password,

To exit from the MySQL console, press Ctrl+D.

* run `mysql_secure_installation`, to complete the installation:

```
$ sudo mysql_secure_installation
```

### 3. Creating MySQL User and Database

3.1. Run MySQL client and enter your MySQL root password

<pre><code><strong>sudo mysql -h localhost -u root -p
</strong></code></pre>

3.2. The following lines create a database `hesdb`, the user with name `hesuser` and password `<user_password>`. Сhange `<user_password>` to a strong password, otherwise you may get a password validator error.

```
CREATE DATABASE hesdb;
CREATE USER 'hesuser'@'%' IDENTIFIED BY '<user_password>';
GRANT ALL ON hesdb.* TO 'hesuser'@'%';
FLUSH PRIVILEGES;
```

To exit from the MySQL console, press Ctrl+D.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enterprise.hideez.com/hideez-enterprise-server/deployment/database-installation/mysql-on-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
