189 8069 5689

centos7安装mariadb数据库-创新互联

1、配置 yum 源

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、网络空间、营销软件、网站建设、任丘网站维护、网站推广。
vim /etc/yum.repos.d/mariadb.repo

 写入数据。本次安装的 mariadb 版本为 10.11

阿里镜像地址为: 阿里镜像 mariadb-yum安装包下载_开源镜像站-阿里云

[mariadb]
name=MariaDB
baseurl=https://mirrors.aliyun.com/mariadb/yum/10.11/centos7-amd64/
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
enabled=1

2、yum 安装 

yum install  -y mariadb-server

3、检查安装情况

[root@abc]# rpm -qa |grep -i mariadb
MariaDB-common-10.11.1-1.el7.centos.x86_64
MariaDB-compat-10.11.1-1.el7.centos.x86_64
MariaDB-client-10.11.1-1.el7.centos.x86_64
MariaDB-server-10.11.1-1.el7.centos.x86_64

或者查看 mariadb 的版本号

mariadb --version
mariadb  Ver 15.1 Distrib 10.11.1-MariaDB, for Linux (x86_64) using readline 5.1

4、开启服务/加入开机自启

1、加入开机自启
systemctl enable mariadb

2、启动服务
systemctl start mariadb

5、数据库初始化

[root@abc /]mysql_secure_installation
-bash: mysql_secure_installation: command not found

执行上面数据库初始化后,报错,查阅资料后发现,从10.5.2开始已经由

mariadb-secure-installation命令替换

mariadb-secure-installation
[root@beian /]# mariadb-secure-installation

Enter current password for root (enter for none): -- 直接回车 
OK, successfully used password, moving on...

Switch to unix_socket authentication [Y/n] n -- 输入 n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y  -- 输入 y -- 设置 root 密码
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

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!

6、进入数据库,设置远程账号

1、进入数据库
[root@abc /]# mysql -uroot -p
Enter password: 

2、设置远程登录账号
MariaDB [(none)]>grant all on *.* to 'test'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected (0.084 sec)

3、刷新配置
flush privileges;

grant all on *.* to 'test'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected (0.084 sec)
flush privileges;

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


网页题目:centos7安装mariadb数据库-创新互联
文章起源:http://jkwzsj.com/article/csgdeh.html

其他资讯