How to use AzerothCore with MySQL 5.7 - azerothcore

After I upgraded my MySQL version from 5.6 to 5.7, the AzerothCore installer fails with errors like:
ERROR 1067 (42000) at line 234: Invalid default value for 'last_login'
ERROR 1292 (22007) at line 266: Incorrect datetime value: '0000-00-00 00:00:00' for column 'last_login' at row 1
and:
Can't find any matching row in the user table

In fact, you better do it like this (to avoid removing default modes):
-- Select the sql modes
SELECT ##sql_mode;
-- Remove the 2 modes NO_ZERO_IN_DATE and NO_ZERO_DATE and run this query
SET sql_mode = 'mode_1,mode_2,mode_3,mode_4,mode_5';
Also this can be put directly in mysql configuration.
After [mysqld]:
[mysqld]
sql_mode = mode_1,mode_2,mode_3,mode_4,mode_5
Note: ONLY_FULL_GROUP_BY can be kept
EDIT: As of march 2019, it's probably not needed at all, we have fixed this but it might occur again in the future

EDIT: this answer is a bit outdated, some of the issues with MySQL 5.7 have been resolved in the latest version
As stated in the requirements page of the AC wiki:
AzerothCore does not officially support MySQL version >= 5.7, but there is a way to get it up and running.
You have to remove ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE and NO_ZERO_DATE flags from MySQL's sql_mode variable in the MySQL config file so that all queries updates and core statements can be applied correctly.
I've found it useful to set my SQL mode to the empty string (which in my case solved all the issues with MySQL 5.7):
SET GLOBAL sql_mode = ''
you can run that sql statement via terminal using:
mysql -e "SET GLOBAL sql_mode = '';"
or alternatively you can manually set the SQL mode before running any SQL statements:
SET sql_mode = '';

Related

I have a small problem with MySQL regarding the first application [duplicate]

Im using xampp control panel and from there i start the process for apache and mysql. Then i go to mysql workbench and server status seems to be ok, here is some info
Host: Windows-PC
Socket: C:/xampp/mysql/mysql.sock
Port: 3306
Version 10.1.31-MariaDB mariadb.org binary distribution
Compiled For: Win32(32)
Configuratin File: unknown
Then everytime when i try to add the foreign key for my dummy schema like:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE;
;
ALTER TABLE `puppies`.`animals`
ADD CONSTRAINT `Breed`
FOREIGN KEY (`BreedID`)
REFERENCES `puppies`.`breeds` (`Breed`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
I get the following error
ERROR 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'' at line 2
SQL Statement:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE
So what can i do so that xampp will start using mysql syntax over mariaDb?
Or if im wrong in my understanding of the problem, then what should i do so that i dont have to face this kind of issues again when using xampp?
Problem is the word VISIBLE, remove it and it will work.
Index are visible by default.
Your question: "If i remove VISIBLE it works just fine, so why did mysql workbench decided to add visible?"
My answer: The option to mark index invisible is not yet implemented in MariaDB (afaik!).
Update:
The syntax for MariaDB is different, please see this reference: https://jira.mariadb.org/browse/MDEV-7317
Just to add to those who are using Maria DB with MySQL Workbench, you don't need to install mysql. You can just change 'Default Target MySQL Version' from Preferences to 5.7 or 5.6, and the VISIBLE keyword will be removed by workbench.
Here is a link from mysql bugs
https://bugs.mysql.com/bug.php?id=92269
I am using MySQL Workbench and have same problem. Change in the Preferences but it did not work.
Solution: If you export forward-engineer the model you need to change the configuration on another place.
Go to Model > Model Options
Inside the Model Options, go to MySQL
Then change the "Target MySQL Version" to 5.6

MariaDB 10.5 changing sql_mode in .cnf does not change ##sql_mode, why?

Fedora Desktop 35 running MariaDB 10.5, completely fresh install from about a month ago.
Why is my change to /etc/my.cnf/mariadb-server.cnf sql_mode changing ##GLOBAL.sql_mode but not ##sql_mode?
I'm trying to remove STRICT_TRANS_TABLES from my sql_mode (I have a column that is DATETIME NOT NULL that I need to omit from an INSERT and have it assume a default value). My system has a simple MariaDB installation with a nearly empty /etc/my.cnf that includes all files in /etc/my.cnf.d where there is a mariadb-server.cnf with a [server] section where I can set sql-mode.
If omitted, it defaults as specified in https://mariadb.com/docs/reference/mdb/system-variables/sql_mode/ to STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION. Confirmed by querying via SquirrelSQL:
SELECT ##GLOBAL.sql_mode global, ##sql_mode;
global ##sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
So by default both ##sql_mode and ##GLOBAL.sql_mode are equivalent.
Adding this to mariadb-server.cnf ([server] line was already there):
[server]
sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Restart server with systemctl restart mariadb, no errors in journal, and re-run the query from above:
global ##sql_mode
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Note that the global sql_mode no longer has STRICT_TRANS_TABLES, but the non-global one does! Why, and what can I do about it?
The insert still fails due to the strict rule being in effect.

Flyway 7.7.3 seems to ignore my "callback"

I am upgrading from Flyway 5.4 to 7.7.3 and ran into some issue.
flyway -teams -url=jdbc:oracle:thin:#localhost:1521/XE "-user=xxx as SYSDBA" -password=xxx -table=flyway_schema_history_app -encoding=utf-8 -baselineOnMigrate=true migrate
(I have the teams edition license)
Flyway gives me the following error message:
**
ERROR: Unable to parse statement in /flyway/sql/incremental/Build_302_Baseline/V302_106__fosprd_INSERT_Master_eg_pocqueue.sql at line 117 col 1. See https://flywaydb.org/documentation/knownparserlimitations for more information: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
Caused by: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
**
This is caused by a special character "&" in the SQL statement, however, I have made sure the SQL file is using UTF-8 encoding as well as Unix return (LF).
Also, I keep my callbacks under:
bash-5.0$ pwd
/flyway/sql/callbacks
bash-5.0$ ls
afterBaseline.sql afterEachUndo.sql afterMigrateError.sql afterUndo.sql beforeEachUndo.sql
afterBaselineError.sql afterEachUndoError.sql afterRepair.sql afterUndoError.sql beforeMigrate.sql
afterEachMigrate.sql afterMigrate.sql afterRepairError.sql beforeEachMigrate.sql beforeUndo.sql
This used to be able to run on 5.4 with no issue. But it's giving me this error on 7.7.3, anyone can point me to the right direction?
Thanks
This is due to the changes between versions of flyway's SQLPlus support and the fat you have a teams license.
As indicated in the message, this is related to SQLPlus's variable substitution:
https://flywaydb.org/documentation/database/oracle#variable-substitution
If you are not using SQLPlus features, you could try disabling them:
https://flywaydb.org/documentation/configuration/parameters/oracleSqlPlus
but the recommended solution is to place SET DEFINE OFF in the SQL script before the offending ampersand (with the option of reverting that afterwards)

MySQL Workbench cannot forward engineer, error 1064 [duplicate]

Im using xampp control panel and from there i start the process for apache and mysql. Then i go to mysql workbench and server status seems to be ok, here is some info
Host: Windows-PC
Socket: C:/xampp/mysql/mysql.sock
Port: 3306
Version 10.1.31-MariaDB mariadb.org binary distribution
Compiled For: Win32(32)
Configuratin File: unknown
Then everytime when i try to add the foreign key for my dummy schema like:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE;
;
ALTER TABLE `puppies`.`animals`
ADD CONSTRAINT `Breed`
FOREIGN KEY (`BreedID`)
REFERENCES `puppies`.`breeds` (`Breed`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
I get the following error
ERROR 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'' at line 2
SQL Statement:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE
So what can i do so that xampp will start using mysql syntax over mariaDb?
Or if im wrong in my understanding of the problem, then what should i do so that i dont have to face this kind of issues again when using xampp?
Problem is the word VISIBLE, remove it and it will work.
Index are visible by default.
Your question: "If i remove VISIBLE it works just fine, so why did mysql workbench decided to add visible?"
My answer: The option to mark index invisible is not yet implemented in MariaDB (afaik!).
Update:
The syntax for MariaDB is different, please see this reference: https://jira.mariadb.org/browse/MDEV-7317
Just to add to those who are using Maria DB with MySQL Workbench, you don't need to install mysql. You can just change 'Default Target MySQL Version' from Preferences to 5.7 or 5.6, and the VISIBLE keyword will be removed by workbench.
Here is a link from mysql bugs
https://bugs.mysql.com/bug.php?id=92269
I am using MySQL Workbench and have same problem. Change in the Preferences but it did not work.
Solution: If you export forward-engineer the model you need to change the configuration on another place.
Go to Model > Model Options
Inside the Model Options, go to MySQL
Then change the "Target MySQL Version" to 5.6

DB2 9.7 cannot enable PL/SQL syntax

After I installed DB2 9.7 Express, I tried to enabled DB2 to support PL/SQL by following command:
DB2SET DB2_COMPATIBILITY_VECTOR=ORA
then I got result as below:
DBI1301E Invalid value.
Explanation:
The value specified for the registry variable is invalid.
User response:
Refer to the DB2 Information Center to determine the valid values for
the registry variable.
For sure, I execute db2set command for list all DB2 register:
C:\Documents and Settings\Administrator>db2set -lr | find "COMP"
DB2_PMAP_COMPATIBILITY
Why my database don't known DB2_COMPATIBILITY register ?
PS. this is my DB2 version
DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09070" with
level identifier "08010107".
Informational tokens are "DB2 v9.7.0.441", "s090521", "NT3297", and Fix Pack
"0".
Product is installed at "C:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".
From the documentation, this feature is not enabled for Express, Express-C, or Personal editions.
DB2 9.7 Infocenter - Restrictions on PL/SQL support
I have DB2 9.7 Express-C (Linux AMD64) installed (same build - s090521) and get the same output as you when I try to set the registry variable (as expected).

Resources