问题描述:
在Linux安装和启动Mysql8.0之后,在部署云服务器时出现数据库表缺失。
原因是系统使用的flowable6.7.2。
数据库中存储的是小写的数据库名,flow able查询时使用的是大写的表名,而Linux的MySQL又区分字母大小写,导致数据库表缺失
解决办法:
1.找到MySQL的数据存储位置
/这是我的数据MySQL安装路径
/usr/local/mysql/mysql-8.0/
2.删除该目录下的data文件夹
rm -rf data
并停止运行MySQL
systemctl stop mysql
3.找到my.cnf文件
vi /etc/my.cnf
将下面的代码粘贴到你的my.cnf文件内
[mysqld]
lower_case_table_names=1
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
lower_case_table_names=1
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = 你的安装路径
datadir = 数据存储路径
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
4.重新初始化MySQL数据库
./mysqld --user=mysql --basedir=/usr/local/mysql-8.0 --datadir=/usr/local/mysql-8.0/data/ --initialize
5.得到临时密码
6.添加mysqld服务到系统
cp -a ./support-files/mysql.server /etc/init.d/mysql
7.授权以及添加服务
chmod +x /etc/init.d/mysql
chkconfig --add mysql
8.启动mysql
systemctl start mysql
9.将mysql命令添加到服务
ln -s /usr/local/mysql-8.0/bin/mysql /usr/bin
10.登录mysql mysql -uroot -p 密码使用之前随机生成的密码
mysql -u root -p
11.修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
12.刷新服务
flush privileges;
13.切换数据库
use mysql
14.允许所有IP远程访问并刷新服务
update user set host='%' where user='root';
flush privileges;
后半段参考
亮亮同學linux 安装mysql8.0 超详细图文教程linux 安装mysql8.0 超详细图文教程_linux安装mysql8.0.26步骤_亮亮同學的博客-CSDN博客