【mysql】1044 - Access denied for user ‘root‘@‘%‘ to database ‘test_job‘

登录mysql 为新建的库创建账号和授权

创建和授权命令

grant all  on test_job.* to job@'%' identified by '12345';

flush  privileges;

返回信息

grant all  on test_job.* to job@'%' identified by '12345'
> 1044 - Access denied for user 'root'@'%' to database 'test_job'
> 查询时间: 0.045s

【mysql】1044 - Access denied for user ‘root‘@‘%‘ to database ‘test_job‘_第1张图片

拒绝用户“root”@“%”访问数据库“test_job”

root权限不够!

修改root用户权限

连接数据库

 mysql -u root -h127.0.0.1  -p

查看mysql用户权限

SELECT host,user,Grant_priv,Super_priv FROM mysql.user;

【mysql】1044 - Access denied for user ‘root‘@‘%‘ to database ‘test_job‘_第2张图片

更新权限

 UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';

刷新

flush  privileges;

再次查看权限

【mysql】1044 - Access denied for user ‘root‘@‘%‘ to database ‘test_job‘_第3张图片

断开远程连接重新连接

再次执行授权创建命令

【mysql】1044 - Access denied for user ‘root‘@‘%‘ to database ‘test_job‘_第4张图片

大功告成!!

你可能感兴趣的:(数据库,mysql,运维,linux)