Sean78Black
Member
- Joined
- May 29, 2016
- Messages
- 84
- Points
- 8
These steps will guide you install MariaDB on CentOS 7/6.5/5.10
1. Adding MariaDB repo
Note: No need to take on CentOS 7. MariaDB on CentOS version 7 is 5.5.37
2. Install or update MariaDB
3. Restart MariaDB và auto run when boot
4. Configure MariaDB
– Start the installation
At the first step you will be asked for the user password, because of the new installation will not have the password, so press Enter to continue.
– Output as following:
Good luck!
1. Adding MariaDB repo
Note: No need to take on CentOS 7. MariaDB on CentOS version 7 is 5.5.37
Code:
## CentOS 6/5 MariaDB 5.5 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/5
## CentOS 6/5 MariaDB 10.0 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/10
Code:
## CentOS 7 ##
yum install -y mariadb mariadb-server
## CentOS 6.5/5.10 ##
yum install -y MariaDB MariaDB-server
Code:
## CentOS 7 ##
systemctl start mariadb.service
systemctl enable mariadb.service
## CentOS 6.5/5.10 ##
service mysql start
chkconfig --levels 235 mysql on
- Set (Change) root password
- Remove anonymous users
- Disallow root login remotely
- Remove test database and access to it
- Reload privilege tables
– Start the installation
Code:
/usr/bin/mysql_secure_installation
– Output as following:
Code:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we\'ll need the current
password for the root user. If you\'ve just installed MariaDB, and
you haven\'t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y
... 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] 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? [Y/n] y
... Success!
Cleaning up...
All done! If you\'ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!