1.yum 安装后先跑一下系统自带的安全脚本,否则数据库很不安全,任何人都可以登录

[root@xixi ~]# mysql_secure_installation

NOTE: 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 current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

#输入root的密码,如果没有root密码直接回车就可以

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 MariaDB
root user without the proper authorisation.

#设置root的密码

Set root password? [Y/n]y

New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

#到此处数据库的root账号密码设置完成。

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

#删除匿名账号

Remove anonymous users? [Y/n]y

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

#是否禁用root账号远程登陆

Disallow root login remotely? [Y/n]n

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

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

#重新加载特权表(是否使以上配置生效)

Reload privilege tables now? [Y/n]y

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

#数据库的安全配置完成

2.[root@xixi ~]# mysql -uroot -p  #mysql -uroot -p123456 也可以登录 但是不安全
Enter password:

用此样式登录数据库,不要-p直接加密码,不安全

3.MariaDB [(none)]> select user();#查看登录的用户

4.默认端口3306

MySQL/MariaDB随笔一的更多相关文章

  1. MySQL/MariaDB随笔二

    mariaDB的二进制安装:系统版本和MariaDB版本 [root@ ~]# cat /etc/redhat-release CentOS Linux release (Core) [root@ ~ ...

  2. MySQL/MariaDB/PerconaDB-提权条件竞争漏洞

    背景 2016年11月01日,国外安全研究员Dawid Golunski在 MySQl, MariaDB 和 PerconaDB 数据库中发现条件竞争漏洞,该漏洞允许本地用户使用低权限(CREATE/ ...

  3. 15 个有用的 MySQL/MariaDB 性能调整和优化技巧(转载的一篇好文)

    MySQL 是一个强大的开源关系数据库管理系统(简称 RDBMS).它发布于 1995 年(20年前).它采用结构化查询语言(SQL),这可能是数据库内容管理中最流行的选择.最新的 MySQL 版本是 ...

  4. 【原】基于 HAproxy 1.6.3 Keeplived 在 Centos 7 中实现mysql mariadb galera cluster 集群分发读写 —— 上篇

    前言 有一段时间没有写blogs,乘着周末开始整理下haproxy + keeplived 实现 mysql mariadb galera cluster 集群访问环境的搭建工作. 本文集中讲hapr ...

  5. 在CentOS 7 MySQL / MariaDB

    在CentOS7中,MariaDB  替代了MySQL;更多复杂的疑问可以在这里查看 MariaDB versus MySQL – Compatibility Install MySQL / Mari ...

  6. MySQL/MariaDB/Percona数据库升级脚本

    MySQL/MariaDB/Percona数据库升级脚本截取<OneinStack>中upgrade_db.sh, 一般情况下不建议升级数据库版本,该脚本专提供给各位版本控们.为防止大版本 ...

  7. MySQL/MariaDB中游标的使用

    本文目录:1.游标说明2.使用游标3.游标使用示例 1.游标说明 游标,有些地方也称为光标.它的作用是在一个结果集中逐条逐条地获取记录行并操作它们. 例如: 其中select是游标所操作的结果集,游标 ...

  8. 流程控制语句(MySQL/MariaDB )

    本文目录:1.BEGIN...END2.true和false3.if结构4.case结构5.loop.leave和iterate6.repeat循环7.while循环 MySQL/MariaDB中的符 ...

  9. MySQL/MariaDB触发器

    本文目录:1.创建触发器2.insert触发器3.delete触发器4.update触发器5.通过on duplicate key update分析触发器触发原理6.replace to算法验证7.查 ...

随机推荐

  1. Mysql 开窗函数实战

    Mysql 开窗函数实战 Mysql 开窗函数在Mysql8.0+ 中可以得以使用,实在且好用. row number() over rank() over dense rank() ntile() ...

  2. 题解 CF160B 【Unlucky Ticket】

    本文为UserUnknown原创 思路 这道题应该怎么做? 可以把输入的数字逐位拆分后存入数组,就像这样存进去: int a[N],b[N] tmp=n; k=1; while(--tmp){ a[k ...

  3. 吃零食 csust oj 贪心

    吃零食 桌上有n袋零食,不同的零食会有不同的美味程度wi和腐坏程度di,每种零食在一单位时间内美味程度都会下降di,但是不会降到0以下. qwb每一单位时间可以吃掉一袋零食.现在qwb想要在吃完所有零 ...

  4. vue项目兼容ie

    一.兼容ES6 Vue 的核心框架 vuejs 本身,以及官方核心插件(VueRouter.Vuex等)均可以在 ie9 上正常使用.但ie不兼容es6,所以需要安装插件将“Promise”等高级语法 ...

  5. (三)Redis &分布式锁

    1 Redis使用中的常见问题和解决办法 1.1 缓存穿透 定义:缓存系统都是按照key去缓存查询,如果不存在对应的value,就应该去DB查找.一些恶意的请求会故意查询不存在的key,请求量很大,就 ...

  6. 动态代理学习(二)JDK动态代理源码分析

    上篇文章我们学习了如何自己实现一个动态代理,这篇文章我们从源码角度来分析下JDK的动态代理 先看一个Demo: public class MyInvocationHandler implements ...

  7. 07_CSS入门和高级技巧(5)

    超级链接美化 1.伪类 同一个超级链接,根据用户的点击情况,有自己样式: 超级链接根据用户点选情况,有4种状态: a:link 没有访问的超级链接 a:visited 已经访问的超级链接 a:hove ...

  8. 使用 React hooks 转化 class 的一些思考

    Hooks 是 React 16.8 的新增特性.它可以让你在不编写 class 的情况下使用 state 以及其他的 React 特性. 使用 React hooks 转化 class 的一些思考 ...

  9. C#实现前向最大匹、字典树(分词、检索)

    场景:现在有一个错词库,维护的是错词和正确词对应关系.比如:错词“我门”对应的正确词“我们”.然后在用户输入的文字进行错词校验,需要判断输入的文字是否有错词,并找出错词以便提醒用户,并且可以显示出正确 ...

  10. Mybatis 快速入门(XML方式)第一天

    导读 架构原理图 说明 mybatis配置文件 SqlMapConfig.xml,此文件为mybatis的全局配置文件,配置了mybatis的运行环境等信息 XXXMapper.xml,此文件作为my ...