zoukankan      html  css  js  c++  java
  • 修改MariaDB-root密码

    在mariadb的配置文件中加入下列一行

    vim /etc/my.conf.d/server.cnf
    [mysqld]
    skip-grant-tables  # 加入此行
    

    重启mariadb服务

    systemctl start mariadb.service
    

    登录mysql

    [root@vps]# mysql
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 8
    Server version: 10.3.21-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    
    MariaDB [mysql]> use mysql
    MariaDB [mysql]> update user set password=password('123456') where User='root';
    Query OK, 4 rows affected (0.001 sec)
    Rows matched: 5  Changed: 4  Warnings: 0
    
    MariaDB [mysql]> flush privileges;
    Query OK, 0 rows affected (0.000 sec)
    
    MariaDB [mysql]> exit
    Bye
    

    还原配置文件
    重启服务再次登录

    [root@tx_sh_vps wordpress]# systemctl restart mariadb.service 
    [root@tx_sh_vps wordpress]# mysql -uroot -p 
    Enter password: 
    
  • 相关阅读:
    Java 对文件的操作
    快速排序算法
    Java 时间和字符换的处理
    Redis 数据结构之Keys
    [转] Redis系统性介绍
    【转】JAVA 接口
    [转] Python 代码性能优化技巧
    几道关于面试的题目
    随手笔记2
    随手笔记
  • 原文地址:https://www.cnblogs.com/moniter/p/14711938.html
Copyright © 2011-2022 走看看