Prior to version 5.6.4, MySQL did not store fractions of a second in temporal data types. (See here). To be cross-database compatible then, we can not rely on straight comparisons of a new Date() to time values read from the database. Instead we must make the time values coarser by rounding down to the nearest second. You can use the following:
long now = new Date().getTime() / 1000;
long someDBtime = foo.getTime() / 1000;
if (now == someDBtime) {
...
Install MySQL (or MariaDB which is already in Fedora repos). For MariaDB the
packages are named mariadb-server
and mysql-connector-java
.
$ sudo yum install mysql-server mysql-connector-java
Create /etc/my.cnf.d/isolation.cnf
and open it in an editor. Add the
following to set the default character collation and transaction isolation
mode:
[mysqld]
# Required for Candlepin
collation-server=utf8_general_ci
character-set-server=utf8
# Required for Candlepin
transaction-isolation=READ-COMMITTED
Enable MySQL/MariaDB with systemd. For MariaDB use mariadb.service
.
$ sudo systemctl enable mysqld.service
$ sudo systemctl start mysqld.service
Create the Candlepin user.
$ mysql --user=root mysql --execute="CREATE USER 'candlepin'@'localhost'; GRANT ALL PRIVILEGES on candlepin.* TO 'candlepin'@'localhost' WITH GRANT OPTION"
Create the Candlepin database
$ mysqladmin --user="candlepin" create candlepin
Add the necessary configuration to /etc/candlepin/candlepin.conf. Make sure you comment out any options that might conflict with the options below!
jpa.config.hibernate.connection.driver_class=com.mysql.jdbc.Driver
jpa.config.hibernate.connection.url=jdbc:mysql:///candlepin
jpa.config.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
jpa.config.hibernate.connection.username=candlepin
jpa.config.hibernate.connection.password=
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql:///candlepin
org.quartz.dataSource.myDS.user = candlepin
org.quartz.dataSource.myDS.password =
org.quartz.dataSource.myDS.maxConnections = 5
Deploy to MySQL.
$ bin/deploy -m