Steps to Install and Configure MariaDB MySQL on CentOS / RedHaT

1.MariaDB MySQL Packages


#yum info  mariadb server

2.Install MariaDB MySQLServer

#rpm -qa |grep -i maria

3 startup MariaDB Database

#systemctl status mariadb

Start the MariaDB mysql server using systemctl as shown below
#systemctl start mariadb
4.connect and verify the mariadb
#mysql -u root (run this cmnd)
mariaDB[(none)]>show databases;
5.Perform MariaDB post installation

#/usr/bin/mysql_secure_installation
Enter current password for root (enter for none):

Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!
Remove anonymous users? [Y/n]
 ... 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? [Y/n]
 ... Success!

By default, MariaDB 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? [Y/n]
 - 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? [Y/n] y
 ... Success!
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

6.Validate MySql root access
Now, if you connect to Mysql without a root password you’ll get the following access denied error message.


[root@ip-172-31-6-109 ec2-user]#  mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@ip-172-31-6-109 ec2-user]#

To specify the password, use the -p option as shown below. This will prompt the user to enter the password.
[root@ip-172-31-6-109 ec2-user]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 27
Server version: 10.3.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Also, as you see below from the show databases command, the test database is now removed.
MariaDB [(none)]>  show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)
If you want to pass the password in the mysql command line, specify it right next to -p option as shown below.


 mysql -u root -pMySecurePassword

Note: There is no space between -p and the password. This might cause some confusion, as we have space between -u and username. But, there is no space between -p and password.
======================================
 add ur comment 










Oldest