zoukankan      html  css  js  c++  java
  • mysql服务设置远程连接

    一、前期准备

    1、虚拟机/物理机    mysql环境(非本机)
    2、本机 navicat软件(验证远程连接)

    二 、mysql配置

    1、在远程主机的本机   使用root用户连接mysql

    mysql -u root -p
    备注 : mysql -u 最高权限用户名 -p   再输入密码进入


    2、设置用户配置项

    (1) 查看用户信息

    select host,user,plugin,authentication_string from mysql.user;


    备注:host为 % 表示不限制ip   localhost表示本机使用    plugin非mysql_native_password 则需要修改密码

    (2)修改用户密码

    ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'newpassword'; #更新一下用户的密码 root用户密码为newpassword


    三、使用navicat连接远程mysql

    未配置情况为,连接拒绝

    mysql连数据库的时候报错:

    1251 client does not support authentication protocol requested by server;consider upgrading Mysql client

    ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'

    先登录mysql

    mysql -u root -p
    输入密码

    mysql> use mysql;
    mysql> select user,host from user;
    +------------------+-----------+
    | user | host |
    +------------------+-----------+
    | root | % |
    | admin | localhost |
    | mysql.infoschema | localhost |
    | mysql.session | localhost |
    | mysql.sys | localhost |
    | zhangj | localhost |
    +------------------+-----------+
    注意我的root,host是'%'

    你可能执行的是:

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
    改成:

    ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';

  • 相关阅读:
    About LabView
    Accuracy, Precision, Resolution & Sensitivity
    EIT: where is it now and what lies ahead?
    <2014 12 28> Some conclusions and thought recently
    <2014 10 01> 数学基础 Wikipedia
    关于HashMap
    elasticsearch index 之 put mapping
    elasticsearch index 之 create index(二)
    elasticsearch index 之 create index(-)
    elasticsearch index 之merge
  • 原文地址:https://www.cnblogs.com/wt88/p/11713219.html
Copyright © 2011-2022 走看看