[root@redhat7 ~]# yum install mariadb*
已安装:
mariadb-bench.x86_64 1:5.5.44-2.el7 mariadb-devel.x86_64 1:5.5.44-2.el7
mariadb-server.x86_64 1:5.5.44-2.el7 mariadb-test.x86_64 1:5.5.44-2.el7
作为依赖被安装:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7
krb5-devel.x86_64 0:1.13.2-10.el7
libcom_err-devel.x86_64 0:1.42.9-7.el7
libselinux-devel.x86_64 0:2.2.2-6.el7
libsepol-devel.x86_64 0:2.1.9-3.el7
libverto-devel.x86_64 0:0.2.5-4.el7
openssl-devel.x86_64 1:1.0.1e-42.el7_1.9
perl-Env.noarch 0:1.04-2.el7
perl-GD.x86_64 0:2.49-3.el7
perl-Test-Simple.noarch 0:0.98-243.el7
完毕!
[root@redhat7 ~]# systemctl start mariadb
[root@redhat7 ~]# systemctl enable mariadb.service
[root@redhat7 ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since 五 2017-04-14 23:03:10 CST; 1min 34s ago
Main PID: 7967 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─7967 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─8129 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/m...
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: You can find addit...
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: http://dev.mysql.com
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: Support MariaDB de...
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: Corporation Ab. Yo...
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: Alternatively cons...
4月 14 23:03:08 redhat7 mariadb-prepare-db-dir[7774]: http://mariadb.com...
4月 14 23:03:08 redhat7 mysqld_safe[7967]: 170414 23:03:08 mysqld_safe ....
4月 14 23:03:08 redhat7 mysqld_safe[7967]: 170414 23:03:08 mysqld_safe ...l
4月 14 23:03:10 redhat7 systemd[1]: Started MariaDB database server.
4月 14 23:03:30 redhat7 systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
#修改root密码 ,因为安装好以后的root密码是空,所以需要设置;
[root@redhat7 ~]# mysqladmin -u root password 'root'
#登陆数据库,如果是本机,那可以直接使用下面的命令登录
[root@redhat7 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> status
-- 查看MySQL的状态
--------------
mysql Ver 15.1 Distrib 5.5.44-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 3
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 5.5.44-MariaDB MariaDB Server
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 7 min 13 sec
Threads: 1 Questions: 9 Slow queries: 0 Opens: 0 Flush tables: 2 Open tables: 26 Queries per second avg: 0.020
--------------
如果是其他机器,使用以下命令,例如192.168.1.10
mysql -h 192.168.1.10 -P 3306 -u root -p
MariaDB [(none)]> show databases;