当前位置:Gxlcms > mysql > MySQL刚安装完只认得的主机是:localhost和127.0.0.1_MySQL

MySQL刚安装完只认得的主机是:localhost和127.0.0.1_MySQL

时间:2021-07-01 10:21:17 帮助过:24人阅读

MySQL刚安装完只认得的主机是:localhost和127.0.0.1,如果你要让你机上的IP可以正常登录有两种办法:

一是对你的IP 172.16.1.10 进行授权

grant privileges on dbname.* to "user "@ "172.16.1.10 " identified by "password ";

如果只是你自己用的话就可以这样写

grant all on *.* to "user "@ "172.16.1.10" identified by "password ";

grant具体的用法你就参考一下mysql的用户手册吧,如果这样不行的话,就只能通过以下方法进行授权了

mysql> use mysql;database changed

mysql> desc user; 查看有多少个字段mysql> insert into user values(val1,val2,....);

二是就将root用户设为可以远程登录,也即是可以从任何机器上登录

mysql> use mysql;

database changed

mysql> update user set host= "%" where user= "root";

mysql>use mysql

grant all on *.* to "root"@"172.30.41.72" identified by "xcfg304";

restart mysql server

方法三:直接在mysql的数据库管理后台执行:

use mysql;

grant all on *.* to "root"@"172.30.41.95" identified by "xcfg304";

人气教程排行