目录
QUESTION:部署WEB应用到云服务器时,出现的部分网页不能显示或者连接数据库问题?
ANSWER:
一:Mysql配置问题
1.1MySQL配置不区分大小写:
1.2设置MySQL字符集
QUESTION:部署WEB应用到云服务器时,出现的部分网页不能显示或者连接数据库问题?
ANSWER:
这种问题的出现在初学者部署linux云服务器时经常发生,本文只讲述在JDK、Tomcat、Mysql等必须应用装好后的情况。
一:Mysql配置问题
在Linux服务器上配置该服务是容易有漏洞的,所以建议大家看我的另一博文是专门写关于MySQL在Linux上的安装的。
MySQL在Linux的完整安装。
以上做完,开始问题的解决。
1.1MySQL配置不区分大小写:
进入etc下面,
vi my.cnf
最后一行加上下面一句:
lower_case_table_names=1
效果如下:
#For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[client]
default-character-set=utf8
[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
#
# 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
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid~
~
"/etc/my.cnf" 33L, 1115C
重启mysql:
systemctl restart mysqld
1.2设置MySQL字符集
进入 etc目录下打开 my.cnf 文件 ,对 my.cnf 进行修改,修改内容如下:
在[mysqld]上面加入下面两句话:
[client] default-character-set=utf8
在[mysqld]最下面加入下面几句话:
default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci
重启MySQL服务:
service mysql restart