«

CentOS7安装MariaDB总结

时间:2022-10-15 19:35     作者:Anglei     分类: 数据库


  1. 通过yum安装
    # yum install mariadb-server mariadb
  2. 设置初始化密码
    systemctl start mariadb
    [root@localhost ~]# mysql
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 2
    Server version: 5.5.52-MariaDB MariaDB Server
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    输入 use mysql;

    MariaDB [(none)]> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed
  3. 输入修改密码的命令:
    update user set password=password("这里替换成你的密码")where user='root';
    MariaDB [mysql]> update user set password=password("xxxx")where user='root';
    Query OK, 4 rows affected (0.00 sec)
    Rows matched: 4  Changed: 4  Warnings: 0
  4. 输入 flush privileges;
    MariaDB [mysql]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
  5. 输入exit退出
    MariaDB [mysql]> exit
    Bye
  6. 重新登录
    测试:在命令行输入mysql,不带登录信息
    [root@localhost ~]# mysql
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    无法进入。

  7. 再测试:带登录信息
    root@localhost ~]# mysql -uroot -pyoonching
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 4
    Server version: 5.5.52-MariaDB MariaDB Server
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

本文完结,相关标签: MariaDB

 版权所有:Anglei
 文章标题:CentOS7安装MariaDB总结
 除非注明,本站文章如未特殊说明均为 MAXADA社区知识库 原创,且版权所有,请勿用于任何商业用途。

推荐阅读:

看完后感想如何?

路过(0)

雷人(0)

握手(0)

鲜花(0)

鸡蛋(0)
分享到: