免输密码登录

第一种

修改/etc/my.cnf,加上skip-grant-tables,重启服务

但是这个会和在my.cnf中指定port冲突,使得指定port无效。

第二种

修改/etc/my.cnf,添加以下内容

[client]
user=root
password=password

重启服务

如果觉得这太容易泄露了,可以chmod 400 my.cnf只让自己可读

Last updated