mysql配置调整
2026年3月12日大约 1 分钟
mysql重启
systemctl restart mysqlmysql配置调整
配置文件备份
cp /etc/my.cnf /etc/my.cnf.bak无法使用group_by问题
/etc/my.cnf
[mysqld]
sql-mode=NO_ENGINE_SUBSTITUTIONphp工具箱sql工具
[mysqld]
general_log=ON
general_log_file = /var/log/mysql/general.log解决导表时提示rowsize 太大报错
[mysqld]
innodb_strict_mode=0可以根据自己的情况,决定是否要放置一个mysql数据库管理脚本
从这里下载
home/wwwroot/default/phpmyadmin 为了安全可以把路径名称修改一下
放置脚本,访问测试
查看配置是否生效
mysql -u root -pselect @@sql_mode;老工具无法连接的问题
Plugin caching_sha2_password could not be loaded
MySQL 8.0+ 默认使用 caching_sha2_password 作为身份验证插件,这是更安全的新算法。
使用的老旧版 SQLyog 不支持这个新插件,无法加载对应的加密库,所以直接报错。
新版 Navicat 能正常连接,正是因为它支持 caching_sha2_password。
修改 MySQL 用户认证插件
mysql -u root -p将 root 用户的认证插件改回旧版 mysql_native_password,兼容老旧 SQLyog:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';查看用户
SELECT user, host FROM mysql.user WHERE user = 'root';没有root'@'%
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;有的话
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';FLUSH PRIVILEGES;查看
SELECT user, host, plugin FROM mysql.user WHERE user='root';