首页 > 代码库 > MySQL刚安装完仅仅认得的主机是:localhost和127.0.0.1
MySQL刚安装完仅仅认得的主机是:localhost和127.0.0.1
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";
MySQL刚安装完仅仅认得的主机是:localhost和127.0.0.1