mysql技巧

mysql8 discuz Database Error 错误解决办法

很难看的一个错误:

mysql8 discuz Database Error 错误解决办法

一般情况下,别犯低级错误,确定密码对了么?如果确定对,命令行下进行测试:

# mysql -h 127.0.0.1 -uroot -p
Enter password: 
ERROR 1130 (HY000): Host '123.12.234.123' is not allowed to connect to this MySQL server

是不是本机的网络状况发生了变化,导致连接mysql的源IP地址发生了变化?比如tinc,增加报错IP的授权:

CREATE USER root@'123.12.234.123' IDENTIFIED BY 'youpassword';
GRANT ALL ON moneyslow.* TO root@'123.12.234.123' WITH GRANT OPTION;

另外,如果报错:Fatal error: Uncaught mysqli_sql_exception: Access denied for user,可以尝试添加mysql配置文件 skip-grant-tables=TRUE
https://www.youtube.com/watch?v=YtvV7TEVHeY