zoukankan      html  css  js  c++  java
  • mariadb(MySql)设置远程访问权限

    【问题】
    mariadb(MySql)安装之后,本地连接mysql是可以的,但是远程的机器不能连接和访问。

    【解决】
    修改mysql远程连接的ip限制配置。

    【步骤】
    1.本地mysql客户端连接mysql

    mysql -u root -p  

    2.执行sql语句:

    新安装的数据库 可以设置  /etc/my.cnf        skip-grant-tables=1(跳过密码验证) 

    --使用mysql系统数据库 
    use mysql;
    --配置192.168.1.10可以通过root:123456访问数据库
    GRANT ALL PRIVILEGES ON
    *.* to 'root'@'192.168.1.10' identified by '123456';
    //grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
    --从mysql数据库中的授权表重新载入权限
    flush privileges;
    --查看用户权限是否变更
    select * from user;

    修改密码

    update user set password=PASSWORD('123456') where user='root';
    update user set authentication_string = password('123456'),password_expired = 'N', password_last_changed = now() where user = 'root';(新版本)

    3.至此,远程访问权限已经配置完成。

    如果有 MySQL 出现“2003-Can't connection to MySQL server on 'localhost' (10061)”

    先看 mysql 服务有没有启动

    systemctl start mariadb

    再看防火墙有没有阻拦

    systemctl stop firewalld
  • 相关阅读:
    淘宝网站
    CentOS 安装 gcc
    待整理
    待整理
    CentOS常用查看系统命令
    Oracle 分区字段数据更新
    MapReduce修改输出的文件名
    MapReduce分区的使用(Partition)
    使用JobControl控制MapReduce任务
    Centos安装ntfs
  • 原文地址:https://www.cnblogs.com/fps2tao/p/7570617.html
Copyright © 2011-2022 走看看