远程连接linux上的mysql

linux服务器安装mysql之后需要进行一些配置操作才能够远程连接

  1. 修改hostpasswordplugin字段

    mysql5.7的user表是没有password的,变成了authentication_string字段。

    plugin需要改为mysql_native_password才能使用密码进行连接。

    update user set host='%',authentication_string=password('要修改的密码'),plugin='mysql_native_password' where user='root';
    
  2. 修改配置文件中的bind-address

    将配置文件中的bind-address=127.0.0.1改为bind-address=0.0.0.0

一般来说不允许root账户远程连接,最好是在服务器端创建用户,然后进行授权后使用新创建的用户进行连接。

原文地址:https://www.cnblogs.com/lovexy-fun/p/14148836.html