今天装mariadb,准备开ipv6远程访问mysql,按照网上教程用命令开启:
1 | grant all privileges on *.* to root@"%" identified by "password" with grant option; |
结果死活连不上,一直以为是ipv6的问题导致失败,于是修改配置文件50-server.cnf的bind-address为::
1 | [mysqld] |
重启mysql,结果还是连不上,最后无奈,把日志打开,发现一直报错
1 | Access denied for user 'root'@'xxxxxxxx' (using password: YES) |
登录mysql,查看用户表
1 | select host, password, user from mysql.user; |
恍然大悟,是最开始的授权指令后面的identified by “password” 导致的root密码和root开始设置的密码混淆了
重新设置密码
1 | set password for ipv6test@'%' = password('xxxxxxx') |
最后成功解决!!!