Review Tomcat7 Ubuntu Package Upgrade Before Updating

Problem

I needed to see what had changed in the new ubuntu update of tomcat 7 before installing the update for apt-get upgrade.

Solution

First check the version of ubuntu installed. Also check the version of ubuntu you are running:

 # lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Then go to the tomcat7 package in Ubuntu and depending on you Ubuntu release check what has changed :

Ubuntu Tomcat 7 Package information (https://launchpad.net/ubuntu/+source/tomcat7)
Ubuntu’s Tomcat7 Package Information (https://launchpad.net/ubuntu/+source/tomcat7)
Ubuntu Tomcat 7 Package information (https://launchpad.net/ubuntu/+source/tomcat7)
Ubuntu’s Tomcat7 Package Information (https://launchpad.net/ubuntu/+source/tomcat7)

Sources

tomcat7 package in Ubuntu

Why don’t the Ubuntu repositories have the latest versions of software?

 

Check Tomcat Version

Problem

Needed to check the version of tomcat running before I could decide whether of not to update it.

Solution

From the command line look for where the version.sh file is:

$ sudo find / -name "version.sh"

Once you find it run this bash script as follows:

# /usr/share/tomcat7/bin/version.sh
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr/lib/jvm/java-7-oracle
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.52 (Ubuntu)
Server built: Jun 30 2016 01:59:37
Server number: 7.0.52.0
OS Name: Linux
OS Version: 3.13.0-53-generic
Architecture: amd64
JVM Version: 1.7.0_80-b15
JVM Vendor: Oracle Corporation

Sources

How to check Tomcat version Installed

MySQL 5.7 Customizations

Problem

Needed to remove the ONLY GROUP BY sql mode and also change the default Character Set

Solution

Login to the MySQL shell and the select the available SQL Modes excluding the ONLY GROUP BY mode:

mysql> select @@sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)[/sourcecode]</pre>
Add the SQL modes to the mysql conf file on Ubuntu 16_04, located in /etc/mysql/mysql.conf.d/mysqld.cnf

Also add the utf8 character set under mysqld in the above conf file so you will have the following:
<pre>[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Then restart MySQL:

root@whiscardz ~ # service mysql stop
root@whiscardz ~ # ps aux | grep mysql
root 9789 0.0 0.0 15444 1028 pts/1 S+ 09:27 0:00 grep --color=auto mysql
root@whiscardz ~ # service mysql start
root@whiscardz ~ # ps aux | grep mysql
mysql 9828 12.0 0.8 1229212 146004 ? Ssl 09:27 0:00 /usr/sbin/mysqld
root 9865 0.0 0.0 15444 980 pts/1 S+ 09:27 0:00 grep --color=auto mysql

Check the Character SET and sql mode:

mysql> select @@sql_mode;
+------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+------------------------------------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show variables where variable_name like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

mysql> show variables where variable_name like '%collation%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)

Update

When doing a load data, change all the blank '' fields to 'NULL' before importing the data. For instance:

Sample File with NULL Fields
Sample File with NULL Fields

Also, when doing a load data on windows, use:

LOAD DATA LOCAL INFILE 'C:/Users/Desktop/data.csv' INTO TABLE 

And Not

LOAD DATA LOCAL INFILE 'C:\Users\Desktop\data.csv' INTO TABLE

For security reasons, when reading text files located on the server, the files must either reside in the database directory or be readable by the user account used to run the server.

Use the following command to see where to place the csv file with data that you want to  import to the server. In the example below it's in /var/lib/mysql-files/

show VARIABLES where variable_name like '%secure%'
show secure file directory

Also to load data into a table using a non-admin user, you need the FILE privilege. This privilege can't be assigned to one database hence needs the wildcard ON *.* for all databases e.g

GRANT FILE on *.* to 'user'@'localhost';

References

Upgrading to MySQL 5.7? Beware of the new STRICT mode

disable-only-full-group-by

mysql-5-7-12-disabling-only-full-group-by-sql-mode-is-not-fully-successful

cant-change-charset-in-mysql-5-7-from-latin-to-utf8

mysql-utf8-character-set

Load data infile, difference between Windows and Linux

LOAD DATA INFILE Syntax