Export database model from MySQLWorkbench to MariaDB PhpMyAdmin - mysql

I designed a database model on MySQLWorkbench. Then, I export the model to generate a SQL script. Finally, when I import it in MariaDB PhpMyAdmin it raises errors like :
#1067 - Invalid default value for 'created'
MariaDB version : 10.5.4
Do you have any idea?

Here is my solution:
create DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
MySQL refused the date to be like this: 0000-00-00 00:00:00

I know this is old, but just ran into this, appears Maria 10.5 won't accept invalid inserts even when ALLOW_INVALID_DATES is set in SQL mode, 10.3 would. I cannot find any reference of this in the documentation, but I can insert invalid dates in 10.3 and cannot in 10.5 on several server I've tested on. Dealing with this in an upgrade from 10.3 on a large database and regardless of whether allowing nulls is a good practice, it's broken a massive application as a result and we're bailing back to 10.3.

Related

Maria DB AES_DECRYPT() with CBC encryption mode

mysql shows error : Error in query (1582): Incorrect parameter count in the call to native function 'AES_DECRYPT'
I'm using mariaDB
I have tried differnet options but all ends up at same place
SET #key_str = '3C5QYgFQr9AARjMyLNNQ3fL8QauXLTz0';
SET #iv = 'kaNUE3JAIVB9Em9v';
SET #ciphertext = AES_ENCRYPT('Hello', #key_str, #iv);
SELECT AES_DECRYPT(#ciphertext, #key_str, #iv);```
My requirement is to use aes-256-cbc encryption using MariaDB
If you are using MariaDB, you should read the MariaDB documentation, not the MySQL documentation.
https://mariadb.com/kb/en/aes_encrypt/ shows AES_ENCRYPT() only has two arguments. This matches the implementation of that function as of MySQL 5.5, when MariaDB forked from MySQL in 2010. Since then, MySQL 5.7 and later changed the function to accept more arguments.
In general, you shouldn't think of MariaDB and MySQL as variants of the same product anymore. They have both changed significantly since they forked, and there are many cases where they are no longer compatible.
Here's a feature request for MariaDB to support the IV and block encryption mode: https://jira.mariadb.org/browse/MDEV-9069
As of 2022-12-12 (version 10.10 is current as I write this), the feature is not yet implemented. So there is no support currently in MariaDB for CBC or other encryption modes. It still functions as it did in MySQL 5.5.

Mysql 1067 error only on newer mysql version can't change value

My online db works with phpadmin version 4.8 and i works fine.
I did download all files to fiddle with wamp ( version 5.7).
Everything starts up but for example "INSERT INTO"won't work on wamp but works fine online.
In this table i have 2 columns with a DATE field like 0000-00-00 for default.
I need to change the default value.
But when i try to change the check-in date it reports 1067 error on check-out date. or the other way around.
So i am not able to change anything.
Is there a way around this problem ?

Type not supported - The JSON data is not available before MySQL 5.7.8

I am running local MySQL instance version of 5.7.23 in Ubuntu-18-04. The DB is already having some tables having JSON fields to store JSON data. They working fine with insert, update and delete operations.
The issue comes when try to modify an existing table to have a new field to store JSON data. MySQL-Workbench is giving an error saying
Type not supported
The JSON data is not available before MySQL 5.7.8.
In order to use it, first set the version for your model to 5.7.8 or
higher
Following screen shots shows my local environment information.
The error:
MySQL server info:
MySQL Workbench info:
I was able to figure the issue. The default version set for Modeling MySQL was set as 5.6.30. Changed it to 5.7.8 and works the table schema modification.
Go to Edit -> Preferences... in MySQL Workbench
Refer the below screens:
Before:
After:
Preference doesn't work for me. I use osx with workbench version 8.0.11.
Model in top bar menu -> Model Options -> MySQL then change the version as Shantha's answer works for me.
Previous version of MySQLWorkbench (6.3.10) has better error message for this...

5.5.52-MariaDB with Magento 2 will it work properly

am trying to import Magento 2 database on 5.5.52-MariaDB. while it was import I got an error the import stop at admin_user ERROR: "MySQL Error There can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause"
I am wondering if 5.5.52-MariaDB isn't the right version and that's why I am getting this error.
As per Magento 2 Docs it does not say which version of MariaDB it requires. Does anybody knows or have more imformation about this? Thank's in advance.
Multiple TIMESTAMP columns with CURRENT_TIMESTAMP in the DEFAULT clause are allowed in MariaDB starting from 10.0. Neither MariaDB 5.5 nor MySQL 5.5 support them.

Mysql Import Error 1293 Timestamp Issue

This has been asked before, but I cannot seem to find a solution that'll work.
I created a database on my localhost server using Mysql, Version information: 4.2.7.1
I have export the .sql file many times and imported it into other localhost servers without any problems.
Now I'm ready to go live, and I am trying to import the .sql file into my hosted server phpMyAdmin. Version information: 4.3.8, latest stable version: 4.6.4
When I do I get error 1293:
SQL Error (1293): Incorrect table definition; there can be only one
TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
I have many tables that have the same 2 columns:
date_created which is set to type timestamp, default current_timestamp
last_update which is set to type timestamp, default NULL, on update CURRENT_TIMESTAMP
This way I can track when a row is added and updated.
How can I change these rows to make the import file work ok?