Ubuntu 20.04 + mysql8 安装以及配置大小写不敏感

126 篇文章 0 订阅
89 篇文章 0 订阅
  • 安装mysql

    apt-get install mysql-server
    

    mysql8在初始化后不允许配置大小写敏感。修改配置文件也没用

解决方案

  1. 先安装;
  2. 修改配置文件,添加lower_case_table_names=1,备份该配置文件;
  3. 卸载mysql;
  4. 保留修改后的配置文件的情况下重装mysql;

This worked for me on a fresh Ubuntu Server 20.04 installation with MySQL 8.0.20 (no existing databases to care about - so if you have important data then you should backup/export it elsewhere before doing this):

So… I did everything with elevated permissions:

# Install MySQL 
apt-get install mysql-server
# Backup configuration file, uninstall it, delete all databases and MySQL related data
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf.backup
service mysql stop
apt-get --purge autoremove mysql-server
rm -R /var/lib/mysql

# Restore saved configuration file, edit the file
cp /etc/mysql/mysql.conf.d/mysqld.cnf.backup /etc/mysql/mysql.conf.d/mysqld.cnf
vim /etc/mysql/mysql.conf.d/mysqld.cnf
 
...
lower_case_table_names=1
...


# Reinstall MySQL (keeping the configuration file), configure additional settings
apt-get install mysql-server
service mysql start
#mysql_secure_installation
sudo mysql -uroot -p
 
SHOW VARIABLES LIKE 'lower_case_%';
exit

重新安装mysql时,会提示本地已经有mysqld.cnf这个配置文件,让你选使用下载来的包里的配置文件还是你本地的。记得选本地的,不要让他覆盖回去。

  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

讓丄帝愛伱

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值