Mysql Installation on CentOS 9

 Mysql Installation on CentOS 9 


Installing MYSQL package

[root@localhost ~]# sudo dnf install mysql-server

CentOS Stream 9 - BaseOS                         10 kB/s | 3.2 kB     00:00   
CentOS Stream 9 - AppStream                      17 kB/s | 3.3 kB     00:00   
CentOS Stream 9 - Extras packages                12 kB/s | 3.5 kB     00:00   
Dependencies resolved.
================================================================================
 Package                       Arch      Version             Repository    Size
================================================================================
Installing:
 mysql-server                  x86_64    8.0.28-1.el9        appstream     16 M
Installing dependencies:
 mariadb-connector-c-config    noarch    3.1.13-3.el9        appstream     11 k
 mecab                         x86_64    0.996-3.el9.3       appstream    356 k
 mysql                         x86_64    8.0.28-1.el9        appstream    2.6 M
 mysql-common                  x86_64    8.0.28-1.el9        appstream     75 k
 mysql-errmsg                  x86_64    8.0.28-1.el9        appstream    473 k
 mysql-selinux                 noarch    1.0.4-2.el9         appstream     36 k
 protobuf-lite                 x86_64    3.14.0-13.el9       appstream    232 k
 
Transaction Summary
================================================================================
Install  8 Packages
Total download size: 20 M
Installed size: 176 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): mariadb-connector-c-config-3.1.13-3.el9.  25 kB/s |  11 kB     00:00  
(2/8): mysql-common-8.0.28-1.el9.x86_64.rpm     105 kB/s |  75 kB     00:00   
(3/8): mecab-0.996-3.el9.3.x86_64.rpm           119 kB/s | 356 kB     00:02   
(4/8): mysql-selinux-1.0.4-2.el9.noarch.rpm      50 kB/s |  36 kB     00:00   
(5/8): mysql-errmsg-8.0.28-1.el9.x86_64.rpm     172 kB/s | 473 kB     00:02   
(6/8): protobuf-lite-3.14.0-13.el9.x86_64.rpm   100 kB/s | 232 kB     00:02   
(7/8): mysql-server-8.0.28-1.el9.x86_64.rpm                                                                                                                                        1.0 MB/s |  16 MB     00:15   
[MIRROR] mysql-8.0.28-1.el9.x86_64.rpm: Curl error (28): Timeout was reached for http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/mysql-8.0.28-1.el9.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(8/8): mysql-8.0.28-1.el9.x86_64.rpm                                                                                                                                                61 kB/s | 2.6 MB     00:43   
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                              467 kB/s |  20 MB     00:44    
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                           1/1
  Installing       : mariadb-connector-c-config-3.1.13-3.el9.noarch                                                                                                                                            1/8
  Installing       : mysql-common-8.0.28-1.el9.x86_64                                                                                                                                                          2/8
  Installing       : mysql-8.0.28-1.el9.x86_64                                                                                                                                                                3/8
  Installing       : mysql-errmsg-8.0.28-1.el9.x86_64                                                                                                                                                          4/8
  Installing       : protobuf-lite-3.14.0-13.el9.x86_64                                                                                                                                                        5/8
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch                                                                                                                                                          6/8
  Installing       : mysql-selinux-1.0.4-2.el9.noarch                                                                                                                                                          6/8
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch                                                                                                                                                          6/8
libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200.
  Installing       : mecab-0.996-3.el9.3.x86_64                                                                                                                                                                7/8
  Running scriptlet: mysql-server-8.0.28-1.el9.x86_64                                                                                                                                                          8/8
  Installing       : mysql-server-8.0.28-1.el9.x86_64                                                                                                                                                          8/8
  Running scriptlet: mysql-server-8.0.28-1.el9.x86_64                                                                                                                                                          8/8
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch                                                                                                                                                          8/8
  Running scriptlet: mysql-server-8.0.28-1.el9.x86_64                                                                                                                                                          8/8
  Verifying        : mariadb-connector-c-config-3.1.13-3.el9.noarch                                                                                                                                            1/8
  Verifying        : mecab-0.996-3.el9.3.x86_64                                                                                                                                                                2/8
  Verifying        : mysql-8.0.28-1.el9.x86_64                                                                                                                                                                 3/8
  Verifying        : mysql-common-8.0.28-1.el9.x86_64                                                                                                                                                          4/8
  Verifying        : mysql-errmsg-8.0.28-1.el9.x86_64                                                                                                                                                          5/8
  Verifying        : mysql-selinux-1.0.4-2.el9.noarch                                                                                                                                                          6/8
  Verifying        : mysql-server-8.0.28-1.el9.x86_64                                                                                                                                                          7/8
  Verifying        : protobuf-lite-3.14.0-13.el9.x86_64                                                                                                                                                        8/8
Installed:
  mariadb-connector-c-config-3.1.13-3.el9.noarch mecab-0.996-3.el9.3.x86_64         mysql-8.0.28-1.el9.x86_64 mysql-common-8.0.28-1.el9.x86_64 mysql-errmsg-8.0.28-1.el9.x86_64 mysql-selinux-1.0.4-2.el9.noarch
  mysql-server-8.0.28-1.el9.x86_64               protobuf-lite-3.14.0-13.el9.x86_64
Complete!
 

Starting the Mysql service and enable in boot


[root@localhost ~]# sudo systemctl start mysqld.service

[root@localhost ~]# sudo systemctl status mysqld

● mysqld.service - MySQL 8.0 database server

     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)

     Active: active (running) since Tue 2022-04-05 14:38:06 IST; 9s ago

    Process: 4095 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)

    Process: 4117 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)

   Main PID: 4204 (mysqld)

     Status: "Server is operational"

      Tasks: 38 (limit: 100343)

     Memory: 462.8M

        CPU: 2.281s

     CGroup: /system.slice/mysqld.service

             └─4204 /usr/libexec/mysqld --basedir=/usr



Apr 05 14:37:56 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...

Apr 05 14:37:56 localhost.localdomain mysql-prepare-db-dir[4117]: Initializing MySQL database

Apr 05 14:38:06 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.

[root@localhost ~]# sudo systemctl enable mysqld

Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

Password Recommendation


[root@localhost ~]# sudo mysql_secure_installation


Securing the MySQL server deployment.

Connecting to MySQL using a blank password.


VALIDATE PASSWORD COMPONENT can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD component?


Press y|Y for Yes, any other key for No: Y



There are three levels of password validation policy:


LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file


Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

Please set the password for root here.

New password:

Re-enter new password: 


Estimated strength of the password: 100 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y

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! 
 

To get the installed version of mysql


[root@localhost ~]# mysqladmin -u root -p version

Enter password: 

mysqladmin  Ver 8.0.28 for Linux on x86_64 (Source distribution)

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.


Server version 8.0.28

Protocol version 10

Connection Localhost via UNIX socket

UNIX socket /var/lib/mysql/mysql.sock

Uptime: 3 min 24 sec


Threads: 2  Questions: 14  Slow queries: 0  Opens: 133  Flush tables: 3  Open tables: 49  Queries per second avg: 0.068

Root Login to mysql localhost


[root@localhost ~]# mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 8.0.28 Source distribution


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.


Comments

Popular posts from this blog

Django Server setup with Apache with mod_wsgi in Centos 9

Install mysql8 on centOS 9 and integrating with Django