How to install MariaDB 10 on CentOS 7 and related configurations
How to install MariaDB 10 on CentOS 7 and related configurations
Step 1: Add MariaDB yum Repository
Add the MariaDB yum configuration file MariaDB. repo in the/etc/YUM. repos. d/directory of the CentOS operating system.
Vi/etc/yum. repos. d/MariaDB. repo
Add the following content to save the file:
[Mariadb]
Name = MariaDB
Base url = http://yum.mariadb.org/10.2/centos7-amd64
Gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Gpgcheck = 1
Step 2: Install MariaDB
Install MariaDB easily using the yum command.
Yum install MariaDB-server MariaDB-client-y
After MariaDB is installed, immediately start the database service daemon process.
Systemctl start mariadb
Set MariaDB to automatically start the service after the operating system restarts.
Systemctl enable mariadb
View the current status of the MariaDB service.
Systemctl status mariadb
Step 3: Configure MariaDB Security
Run the following command to perform security configuration and use Y/N to reply to the following questions: Set the root account password of MariaDB, delete anonymous users, disable root remote logon, and delete the test database, reload the permission table.
Mysql_secure_installation
I chose Y and press Enter.
After configuring the Security Configuration of the database, run the following command to check the version to verify that MariaDB has been installed successfully.
Mysql -- version
You can log on through the MariaDB command line and perform SQL query on the database.
Mysql-u root-p
Step 4: configure remote access permissions for MariaDB
In step 3, If you disable root remote logon and select Y, you cannot connect to the database on another computer using tools such as navicat. In this case, you need to assign permissions to the corresponding MariaDB account, allow this account to remotely connect to MariaDB. Run the following command to view the account information:
Select User, host from mysql. user;
The host entry in the root account is localhost, indicating that this account can only perform local login. We need to modify the permission and enter the command:
Grant all privileges on *. * TO 'root' @ '%' identified by 'Password' with grant option;
Modify permissions. % Indicates all IP addresses, and password indicates that the password will be used to log on to the root user. To connect only hosts in an IP segment, you can change it:
Grant all privileges on *. * TO 'root' @ '1970. 192.% 'identified by 'my-new-password' with grant option;
Don't forget:
Flush privileges;
Save the changes and check the user account information:
At this time, we found that the host item is %, which indicates that the configuration is successful. We can use this account for remote access.
Step 5: Open the firewall port in CentOS 7
After step 4, if the database cannot be remotely connected, port 3306 is blocked by the firewall. In this case, we need to disable the firewall or open the firewall port.
Disable Firewall:
Systemctl stop firewalld. service # stop firewall
Systemctl disable firewalld. service # disable firewall startup
Open the firewall port. Restart the firewall after it is enabled:
Firewall-cmd -- zone = public -- add-port = 3306/tcp -- permanent
Firewall-cmd -- reload
Step 6: Set the database letters to be case insensitive
Vi/etc/my. cnf. d/server. cnf
Add it under [mysqld]
Lower_case_table_names = 1
The default value is 0, which is case sensitive. Change to 1 and then OK. If you have already created a database, you must delete it before it takes effect.
Step 7: Set the default encoding of the MariaDB Database
MariaDB's default encoding is latin1, and Chinese characters are garbled. Therefore, you need to change the encoding to utf8.
1. log on and use the following command to view the character set currently in use. Several of them should not be in utf8 format.
Show variables like 'character % ';
2. Modified configuration file
Vi/etc/my. cnf. d/client. cnf
Add in the [client] Field
Default-character-set = utf8
Vi/etc/my. cnf. d/server. cnf
Add in the [mysqld] Field
Character-set-server = utf83. restart MariaDB to take effect.
Systemctl restart mariadb
For more MariaDB tutorials, see the following:
Install Nginx, MariaDB, and HHVM on Ubuntu 16.04 LTS to run the WordPress https://www.bkjia.com/Linux/2016-10/136435.htm
Ubuntu 16.04 Dockerfile install MariaDB https://www.bkjia.com/Linux/2016-09/135260.htm
Linux Tutorial: How to check MariaDB server version https://www.bkjia.com/Linux/2015-08/122382.htm
How to install MariaDB https://www.bkjia.com/Linux/2017-04/142915.htm in Ubuntu 16.04
CentOS 7.3 binary installation MariaDB10.2.8 step https://www.bkjia.com/Linux/2017-10/147904.htm
CentOS 7 compile and install MariaDB-10.1.22 https://www.bkjia.com/Linux/2017-05/143291.htm
How to migrate MySQL 5.5 database to MariaDB 10 https://www.bkjia.com/Linux/2014-11/109471.htm on Ubuntu
Ubuntu 14.04 (Trusty) Server install MariaDB https://www.bkjia.com/Linux/2014-12/110048htm
Ubuntu 14.04 (Trusty) install MariaDB 10 database https://www.bkjia.com/Linux/2016-11/136833.htm
MariaDB details: click here
MariaDB's: click here
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151403.htm