Current system: Centos7.1mini
Add MariaDB yum source in /etc/yum.repos.d/mariadb.repo
[Mariadb]name = Mariadbbaseurl = http://yum.mariadb.org/10.1/centos7-amd64gpgkey=https://yum.mariadb.org/ Rpm-gpg-key-mariadbgpgcheck=1
Install MARIADB:
Yum Install Mariadb-server mariadb-client
Start the MARIADB service after installation is complete
Service MARIADB Start
Or
Systemctl Start mariadb
MARIADB need to set security after installation, including password, anonymous user, etc.
Execute the following command without parameters in the shell window:
Mysql_secure_installation
[[Email protected] toolcase]# mysql_secure_installationnote: 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 currentpassword for the root user. if you ' ve just Installed mariadb, andyou 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 mariadbroot user without the proper Authorisation. set root password? [y/n] ynew password: re-enter new password: password updated successfully! Reloading privilege tables. ... success! by default, a mariadb installation has an anonymous user, allowing anyoneto log into mariadb without having to have a user account created forthem. this is intended only for Testing, and to make the installationgo a bit smoother. you should remove them before moving into aproduction environment. remove anonymous users? [y/n] y ... success! Normally, root should only be allowed to connect from ' localhost '. thisensures 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 canaccess. this is also intended only for testing, And should be removedbefore 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 farwill 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 mariadbinstallation should now be secure. thanks for using mariadb!
Grant statement creates a user and authorizes
The syntax for the GRANT statement looks like this:
Grant privileges (columns) on the What to the user identified by ' password ' with GRANT OPTION
To use this statement, you need to fill in the following sections:
Privileges
Permissions granted to the user, the following table lists the permission specifiers that are available for the GRANT statement:
Allowed actions for permission specifier permissions
Alter Modify tables and indexes
Create DATABASE and tables
Delete Deletes existing records in the table
For more information, please refer to the link Grant
Installing MARIADB with Yum