Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-05-31 08:46:30
Original
996 people have browsed it

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";

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template