1, installation mariadb
Installation commands
Yum-y Install mariadb Mariadb-server
Installation Complete mariadb, first start mariadb
Systemctl Start mariadb
Set boot up
Systemctl Enable MARIADB
The following is a simple configuration of mariadb
Mysql_secure_installation
The first is to set the password, you will be prompted to enter the password
Enter current password to root (enter for none): <– First run direct carriage return
Set Password
Set root Password? [y/n] <– whether to set the root user password, enter Y and return or direct enter
New Password: <– Set the root user's password
Re-enter new password: <– Enter the password you set again
Other configurations
Remove anonymous users? [y/n] <– Whether to delete anonymous users, enter
Disallow Root login remotely? [y/n] <– Whether root login is forbidden, enter,
Remove test database and access to it? [y/n] <– Whether to delete the test database, enter
Reload privilege tables now? [y/n] <– whether to reload the permissions table, enter
Initialize MARIADB complete, next Test login
Mysql-uroot-ppassword
Complete.
[Email protected] ~]# Rpm-qa | grep MySQL
[Email protected] ~]# Rpm-qa | grep mariadb
Mariadb-libs-5.5.56-2.el7.x86_64
[Email protected] ~]# Find/-name mariadb-libs-5.5.56-2.el7.x86_64
Find: '/RUN/USER/1000/GVFS ': Insufficient authority
[[email protected] ~]# find. -name mariadb-libs-5.5.56-2.el7.x86_64
[Email protected] ~]#
[Email protected] ~]# yum-y install mariadb mariadb-server
Loaded plugins: Fastestmirror, LangPacks
Could not retrieve Mirrorlist Http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock Error was
12:timeout on Http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock: (' Operation Too slow. Less than-Bytes/sec transferred the last of seconds ')
Base | 3.6 KB 00:00:00
Could not retrieve Mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra= Stock error was
12:timeout on Http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock: (28, ' Operation too slow. Less than-Bytes/sec transferred the last of seconds ')
Extras | 3.4 KB 00:00:00
Could not retrieve Mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra= Stock error was
12:timeout on Http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock: (28, ' Operation too slow. Less than-Bytes/sec transferred the last of seconds ')
Updates | 3.4 KB 00:00:00
Loading mirror speeds from cached hostfile
* base:mirrors.aliyun.com
* extras:mirrors.aliyun.com
* updates:mirrors.aliyun.com
Resolving dependencies
--Checking transactions
---> Package mariadb.x86_64.1.5.5.56-2.el7 will be installed
---> Package mariadb-server.x86_64.1.5.5.56-2.el7 will be installed
--The dependency perl-dbi is being processed and it is required by the package 1:mariadb-server-5.5.56-2.el7.x86_64
--The dependency perl-dbd-mysql is being processed and it is required by the package 1:mariadb-server-5.5.56-2.el7.x86_64
and is processing dependencies perl (Data::D umper), which is required by the package 1:mariadb-server-5.5.56-2.el7.x86_64
and is working with Dependencies Perl (DBI), which is required by the package 1:mariadb-server-5.5.56-2.el7.x86_64
--Checking transactions
---> Package perl-dbd-mysql.x86_64.0.4.023-5.el7 will be installed
---> Package perl-dbi.x86_64.0.1.627-4.el7 will be installed
--With Dependencies Perl (RPC::P lserver) >= 0.2001, it is required by the package perl-dbi-1.627-4.el7.x86_64
--With Dependencies Perl (RPC::P lclient) >= 0.2000, it is required by the package perl-dbi-1.627-4.el7.x86_64
---> Package perl-data-dumper.x86_64.0.2.145-3.el7 will be installed
--Checking transactions
---> Package perl-plrpc.noarch.0.0.2020-14.el7 will be installed
and is working on Dependencies Perl (Net::D Aemon) >= 0.13, which is required by the package Perl-plrpc-0.2020-14.el7.noarch
and is processing dependencies perl (Net::D aemon::test), which is required by the package Perl-plrpc-0.2020-14.el7.noarch
and is processing dependencies perl (Net::D aemon::log), which is required by the package Perl-plrpc-0.2020-14.el7.noarch
and is processing dependencies Perl (Compress::zlib), which is required by the package Perl-plrpc-0.2020-14.el7.noarch
--Checking transactions
---> Package perl-io-compress.noarch.0.2.061-2.el7 will be installed
--and is processing dependencies perl (compress::raw::zlib) >= 2.061, which is required by the package Perl-io-compress-2.061-2.el7.noarch
--and is processing dependencies perl (COMPRESS::RAW::BZIP2) >= 2.061, which is required by the package Perl-io-compress-2.061-2.el7.noarch
---> Package perl-net-daemon.noarch.0.0.48-5.el7 will be installed
--Checking transactions
---> Package perl-compress-raw-bzip2.x86_64.0.2.061-3.el7 will be installed
---> Package perl-compress-raw-zlib.x86_64.1.2.061-4.el7 will be installed
--Resolve dependency completion
Dependency resolution
========================================================================================
Package schema version Source size
========================================================================================
Installing:
MARIADB x86_64 1:5.5.56-2.EL7 Base 8.7 M
Mariadb-server x86_64 1:5.5.56-2.EL7 Base One M
To install for dependency:
Perl-compress-raw-bzip2 x86_64 2.061-3.el7 Base K
Perl-compress-raw-zlib x86_64 1:2.061-4.el7 Base, K
Perl-dbd-mysql x86_64 4.023-5.el7 Base K
PERL-DBI x86_64 1.627-4.EL7 Base 802 k
Perl-data-dumper x86_64 2.145-3.el7 Base K
Perl-io-compress Noarch 2.061-2.EL7 Base 260 k
Perl-net-daemon Noarch 0.48-5.el7 base Wuyi K
Perl-plrpc Noarch 0.2020-14.el7 Base K
Transaction summary
========================================================================================
Install 2 packages (+8 dependent packages)
Total Downloads: M
Installation Size: M
Downloading packages:
Warning:/var/cache/yum/x86_64/7/base/packages/mariadb-server-5.5.56-2.el7.x86_64.rpm: header V3 RSA/SHA256 Signature, key ID F4a80eb5:nokey
MARIADB-SERVER-5.5.56-2.EL7.X86_64.RPM public key is not installed
(1/10): mariadb-server-5.5.56-2.el7.x86_64.rpm | One MB 00:00:02
(2/10): mariadb-5.5.56-2.el7.x86_64.rpm | 8.7 MB 00:00:02
(3/10): perl-compress-raw-bzip2-2.061-3.el7.x86_64.rpm | 00:00:00 KB
(4/10): perl-compress-raw-zlib-2.061-4.el7.x86_64.rpm | KB 00:00:00
(5/10): perl-dbd-mysql-4.023-5.el7.x86_64.rpm | KB 00:00:00
(6/10): perl-data-dumper-2.145-3.el7.x86_64.rpm | KB 00:00:00
(7/10): perl-io-compress-2.061-2.el7.noarch.rpm | 260 KB 00:00:00
(8/10): perl-net-daemon-0.48-5.el7.noarch.rpm | Wuyi 00:00:00
(9/10): perl-plrpc-0.2020-14.el7.noarch.rpm | KB 00:00:00
(10/10): perl-dbi-1.627-4.el7.x86_64.rpm | 802 KB 00:00:00
----------------------------------------------------------------------------------------
Total 8.1 mb/s | MB 00:02
Retrieving Keys from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Import GPG key 0XF4A80EB5:
User id: "CentOS-7 Key (CentOS 7 official Signing key) <[email protected]>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package: centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
From:/etc/pki/rpm-gpg/rpm-gpg-key-centos-7
Running transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-data-dumper-2.145-3.el7.x86_64 1/10
Installing: 1:mariadb-5.5.56-2.el7.x86_64 2/10
Installing: perl-compress-raw-bzip2-2.061-3.el7.x86_64 3/10
Installing: 1:perl-compress-raw-zlib-2.061-4.el7.x86_64 4/10
Installing: Perl-io-compress-2.061-2.el7.noarch 5/10
Installing: Perl-net-daemon-0.48-5.el7.noarch 6/10
Installing: Perl-plrpc-0.2020-14.el7.noarch 7/10
Installing: perl-dbi-1.627-4.el7.x86_64 8/10
Installing: perl-dbd-mysql-4.023-5.el7.x86_64 9/10
Installing: 1:mariadb-server-5.5.56-2.el7.x86_64 10/10
Verified in: perl-dbi-1.627-4.el7.x86_64 1/10
Verified in: Perl-net-daemon-0.48-5.el7.noarch 2/10
Verified in: perl-data-dumper-2.145-3.el7.x86_64 3/10
Verified in: Perl-plrpc-0.2020-14.el7.noarch 4/10
Verified in: 1:perl-compress-raw-zlib-2.061-4.el7.x86_64 5/10
Verified in: perl-compress-raw-bzip2-2.061-3.el7.x86_64 6/10
Verified in: 1:mariadb-server-5.5.56-2.el7.x86_64 7/10
Verified in: Perl-io-compress-2.061-2.el7.noarch 8/10
Verified in: perl-dbd-mysql-4.023-5.el7.x86_64 9/10
Verified in: 1:mariadb-5.5.56-2.el7.x86_64 10/10
has been installed:
mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7
To be installed as a dependency:
Perl-compress-raw-bzip2.x86_64 0:2.061-3.EL7
Perl-compress-raw-zlib.x86_64 1:2.061-4.EL7
Perl-dbd-mysql.x86_64 0:4.023-5.EL7
Perl-dbi.x86_64 0:1.627-4.EL7
Perl-data-dumper.x86_64 0:2.145-3.EL7
Perl-io-compress.noarch 0:2.061-2.EL7
Perl-net-daemon.noarch 0:0.48-5.EL7
Perl-plrpc.noarch 0:0.2020-14.EL7
Complete!
[Email protected] ~]# systemctl start mariadb
[Email protected] ~]# Systemctl enable MAIADB
Failed to execute operation:no such file or directory
[Email protected] ~]# Systemctl enable MARIADB
Created symlink From/etc/systemd/system/multi-user.target.wants/mariadb.service to/usr/lib/systemd/system/ Mariadb.service.
[Email protected] ~]# mysql_secure_installation
Note:running all PARTS of this SCRIPT are 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 would be blank,
So, should just press ENTER here.
Enter current password to 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 have an anonymous user, allowing anyone
To log into MariaDB without has to has a user account created for
them. This was intended only for testing, and 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 is allowed to connect from ' localhost '. This
Ensures that someone cannot guess at the root of 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 was 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 would ensure that all changes made so far
would take effect immediately.
Reload privilege tables now? [y/n]
... success!
Cleaning up ...
All done! If you ' ve completed all of the above steps, your MariaDB
Installation should now is secure.
Thanks for using mariadb!
[Email protected] ~]# mysql-u root-p
Enter Password:
Welcome to the MariaDB Monitor. Commands End With; or \g.
Your MariaDB Connection ID is 10
Server VERSION:5.5.56-MARIADB MariaDB Server
Copyright (c), Oracle, MariaDB Corporation Ab and others.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
MariaDB [(None)]>
2. Configuring the MARIADB Character Set
File/etc/my.cnf
Vi/etc/my.cnf
Add under the [Mysqld] tab
init_connect= ' Set collation_connection = Utf8_unicode_ci ' init_connect= ' Set NAMES UTF8 ' Character-set-server=utf8 Collation-server=utf8_unicode_ci Skip-character-set-client-handshake
File/etc/my.cnf.d/client.cnf
Vi/etc/my.cnf.d/client.cnf
Add in [client]
Default-character-set=utf8
File/etc/my.cnf.d/mysql-clients.cnf
Vi/etc/my.cnf.d/mysql-clients.cnf
Add in [MySQL]
Default-character-set=utf8
Complete configuration, restart MARIADB
Systemctl Restart MARIADB
Then enter MARIADB to view the character set
[Email protected] ~]# mysql-u root-p
Enter Password:
Welcome to the MariaDB Monitor. Commands End With; or \g.
Your MariaDB Connection ID is 14
Server VERSION:5.5.56-MARIADB MariaDB Server
Copyright (c), Oracle, MariaDB Corporation Ab and others.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
MariaDB [(none)]> show variables like "%character%", show variables like "%collation%";
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set _connection | UTF8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir |/usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (0.01 sec)
+----------------------+-------------------+
| variable_name | Value |
+----------------------+-------------------+
| collation_connection | Utf8_general_ci |
| Collation_database | Latin1_swedish_ci |
| Collation_server | Latin1_swedish_ci |
+----------------------+-------------------+
3 Rows in Set (0.00 sec)
CentOS 7 MARIADB Installation