4

Mysql 修改大小写敏感问题

 2 years ago
source link: https://www.jansora.com/notebook/107515
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Mysql 修改大小写敏感问题Mysql 修改大小写敏感问题 导航前往主站应用闲文杂记代码在线

注意此流程会清理所有数据, 请先芬苯

vim /etc/mysql/mysql.conf.d/mysqld.cnf 添加以下属性

[mysqld]
# 大小写
lower_case_table_names=1


rm -rf /var/lib/mysql
  1. 初始化数据库
/usr/sbin/mysqld --initialize --user=mysql --lower-case-table-names=1 --log_bin_trust_function_creators=1 

3.1 如果有遇到初始化数据库后无法进入mysql终端的行为, 请在 /etc/mysql/mysql.conf.d/mysqld.cnf 下加入

[mysqld]
skip-grant-tables = 1
plugin-load-add = auth_socket.so
  1. 重启并进入MYSQL
root@l1:/var/lib/mysql# systemctl restart mysql
root@l1:/var/lib/mysql# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

参考 https://stackoverflow.com/questions/41984956/cant-reset-root-password-with-skip-grant-tables-on-ubuntu-16

  1. 在配置完密码和远程访问后, 需要删除掉 3.1 新增的属性. 否则远程访问时无法访问

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK