简体   繁体   English

在CentOS 7上使用lower_case_table_names设置mysql 8

[英]Set up mysql 8 with lower_case_table_names on CentOS 7

I'm trying to set up a mysql 8 intsall on centos 7 and am having a hell of a time. 我正在尝试在centos 7上设置mysql 8 intsall,现在真是个地狱。 We have some legacy software that was connecting to old mysql dbs via lowercase names and I want to carry that over to this new setup. 我们有一些旧版软件通过小写名称连接到旧的mysql数据库,我想将其延续到新的设置中。

I'm having issues with setting this config properly, I don't know what file to set or when to set it or even what user/permission level to set it under. 我在正确设置此配置时遇到问题,我不知道要设置哪个文件,何时设置它,甚至不知道要在哪个文件下设置用户/权限级别。

When I set it to 1 in /etc/my.cnf then try to start up mysqld I get: 当我在/etc/my.cnf中将其设置为1时,尝试启动mysqld我得到:

[ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('0') and data dictionary ('1').

I've reinstalled mysql thinking a fresh start would help with my /etc/my.cnf with the following settings: 我已经重新安装了mysql,认为重新启动对以下设置的/etc/my.cnf有所帮助:

lower_case_table_names=1
default_authentication_plugin=mysql_native_password
bind-address=REDACTED
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

After installing mysql-server and copying the .cnf file to it's spot I run: 安装mysql-server并将.cnf文件复制到它的位置后,我运行:

mysqld --defaults-file=/etc/my.cnf

and am greeted with: 并得到了:

2018-10-22T21:30:27.826322Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2018-10-22T21:30:27.826414Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2018-10-22T21:30:28.057606Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/be-db-10.lower-test
2018-10-22T21:30:28.057668Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.13) starting as process 27077
2018-10-22T21:30:28.060609Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/be-db-10.lower-test
2018-10-22T21:30:28.060628Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/be-db-10.lower-test
2018-10-22T21:30:28.061062Z 0 [ERROR] [MY-010187] [Server] Could not open file '/var/log/mysqld.log' for error logging: Permission denied
2018-10-22T21:30:28.061098Z 0 [ERROR] [MY-010119] [Server] Aborting

I assume at some point I royally screwed up some permissions or mysql isn't being fully removed? 我认为在某个时候我已经搞砸了一些权限,或者mysql没有被完全删除?

Before the value lower_case_table_names can be changed, unistall mysql on CentOs 7 在可以更改值lower_case_table_names之前,在CentOs 7上取消安装mysql

yum remove mysql mysql-server

After uninstall process, rename or delete mysql data 卸载过程后,重命名或删除mysql数据

mv /var/lib/mysql /var/lib/mysql_backup (backup) or rm -rf /var/lib/mysql (remove) mv /var/lib/mysql /var/lib/mysql_backup (备份)或rm -rf /var/lib/mysql (删除)

Install again mysql 再次安装mysql

yum install mysql mysql-server

Before run the mysql server, add lower_case_table_names=1 on /etc/my.cnf , ex: nano /etc/my.cnf Save the file and then start the mysql server with command systemctl start mysqld 在运行mysql服务器之前,在/etc/my.cnf上添加lower_case_table_names=1 ,例如: nano /etc/my.cnf保存文件,然后使用命令systemctl start mysqld mysql服务器systemctl start mysqld

checking the result can be done with query SHOW VARIABLES like 'lower%'; 可以通过查询SHOW VARIABLES like 'lower%';来检查结果SHOW VARIABLES like 'lower%';

you should get lower_case_table_names with value 1 您应该获得具有值1 lower_case_table_names

I hope it can help. 希望对您有所帮助。

I'm pretty sure lower_case_table_names must be set before installing. 我很确定安装之前必须先设置lower_case_table_names The new "Data Dictionary" needs to be constructed once with the setting frozen. 冻结设置 ,只需构造一次新的“数据字典”。

So, yes, fully remove, and completely start over (after changing my.cnf). 因此,是的,完全删除并完全重新开始(更改my.cnf之后)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM