環(huán)境
系統(tǒng):CentOS Stream release 9
mysql版本:mysql Ver 8.0.34 for Linux on x86_64
問題
mysql登錄提示
Access denied for user 'root'@'localhost' (using password: YES)
解決方法
編輯 /etc/my.cnf ,在[mysqld] 部分最后添加一行
skip-grant-tables
保存后重啟mysql
systemctl restatus mysqld
輸入以下命令,回車后輸入密碼再回車登錄Mysql
mysql -uroot -p mysql
重新設置密碼,其中 your_pwd 部分改為你自己想要設置的密碼
update user set password=password(“your_pwd”) where user=‘root’;
刷新權限
flush privileges;文章來源地址http://www.zghlxwxcb.cn/news/detail-665582.html
修改完成后my.cnf刪除skip-grant-tables
想要修改成簡單密碼
修改密碼策略
set global validate_password.policy=LOW;
set global validate_password.length=6;文章來源:http://www.zghlxwxcb.cn/news/detail-665582.html
刷新權限
flush privileges;
到了這里,關于centos mysql8解決Access denied for user ‘root‘@‘localhost‘ (using password: YES)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!