• debian9修改MariaDB用户密码和配置


    默认安装完MariaDB查看密码 /etc/mysql/debian.cnf,这个密码是属于debian-sys-maint

    修改MariaDB root密码

    1、登录MariaDB,查看默认的连接方式

    select user, plugin from mysql.user;
    

    2、如果是auth_socket`(MySQL)的连接方式,则继续下面得步骤

    update mysql.user set authentication_string=password('123456'), plugin = 'mysql_native_password' where user = 'root';
    flush privileges;
    

    3、如果是unix_socket(MariaDB)

    MariaDB的root默认连接方式是`unix_socket`(MariaDB),在Debian中软件包mysql已经替换成了mariadb了
    在安装后/etc/mysql/debian.cnf预设了root用户使用socket的连接方式,所以不输入密码也可在命令行直接使用mysql命令登录。

    update mysql.user set authentication_string = password('Skills39'), plugin = 'mysql_native_password' where user = 'root' and host = 'localhost'; 
    flush privileges;
    

    4、修改 /etc/mysql/mariadb.conf.d/50-server.cnf

    bind-address`为允许连接的网络地址,若为整个网络则填入`0.0.0.0`或注释掉
    

    5、创建用户并且授权  

    第一种方式
    CREATE USER 'root'@'192.168.10.%' IDENTIFIED BY '123456';                    
    grant all on *.* to 'root'@'192.168.10.%';
    privileges all;
    
    第二种方式
    GRANT ALL ON *.* TO 'myuser'@'192.168.10.%' IDENTIFIED BY '123456';
    
    
    用以上命令授权的用户不能给其它用户授权,如果想让该用户可以授权,用以下命令:
    GRANT privileges ON databasename.tablename TO 'username'@'host' WITH GRANT OPTION;
    

    6、修改完配置需要重启mysql

    /etc/init.d/mysql restart
  • 相关阅读:
    JavaScript简单的日历
    CSS动画实现滚动播放
    视频弹窗自动播放 关闭停止
    简单通过js实现轮播图
    switch case的应用
    显示、隐藏
    .container的应用
    用CSS对HTML进行初始化设置
    CSS Id 和 Class选择器
    给文字添加阴影效果
  • 原文地址:https://www.cnblogs.com/lucktomato/p/15993185.html
Copyright © 2020-2023  润新知