Disable strict mode on MariaDB - mariadb

When i run this sql in phpmyadmin
SELECT ##SQL_MODE, ##GLOBAL.SQL_MODE;
it shows
##SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
##GLOBAL.SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
How to Disable strict mode on MariaDB using phpmydmin?

Edit via SSH
/etc/my.cnf file
Add
sql_mode=NO_ENGINE_SUBSTITUTION
restart MariaDB
and it will fix the issue
*edit - if You have error while restarting msyql service try to add "[mysqld]" above in my.cnf

This worked for me:
root#MaRs:/etc/mysql# cat my.cnf|grep -v \#
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
root#MaRs:/etc/mysql#
MariaDB [(none)]> SELECT ##SQL_MODE, ##GLOBAL.SQL_MODE;
+------------------------+------------------------+
| ##SQL_MODE | ##GLOBAL.SQL_MODE |
+------------------------+------------------------+
| NO_ENGINE_SUBSTITUTION | NO_ENGINE_SUBSTITUTION |
+------------------------+------------------------+
1 row in set (0.000 sec)

Related

apache airflow configuration is empty and dags && plugins missing

I have installed apache airflow on Ubuntu 18.4 using this link https://airflow.apache.org/docs/apache-airflow/stable/start/local.html
now when i run airflow with
airflow webserver --port 8080
and the Admin/Configurtion is empty and there is this message:
"Your Airflow administrator chose not to expose the configuration,
most likely for security reasons."
What i did wrong?
More information that me be helpfull is that i created an user[airflow] and do all installtion with sudo , so my airflow info is :
Paths info
airflow_home | /home/airflow/airflow
system_path | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
python_path | /usr/local/bin:/usr/lib/python36.zip:/usr/lib/python3.6:/usr/lib/python3.6/lib-dynload:/usr/local/lib/python3.6/dist-packages:/usr/lib/python3/dist-pac
| kages:/home/airflow/airflow/dags:/home/airflow/airflow/config:/home/airflow/airflow/plugins
airflow_on_path | True
Config info
executor | LocalExecutor
task_logging_handler | airflow.utils.log.file_task_handler.FileTaskHandler
sql_alchemy_conn | postgresql+psycopg2://airflow:airflow#localhost:5432/airflow
dags_folder | /home/airflow/airflow/dags
plugins_folder | /home/airflow/airflow/plugins
base_log_folder | /home/airflow/airflow/logs
However these folder does not exists also :/home/airflow/airflow/dags && /home/airflow/airflow/plugins
You will probably need to set expose_config = True in airflow.cfg and restart the web-server.
As #somuchtolearnandshare mentioned, it should be AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "True"
If You are running airflow inside the docker using the YAML file then please go to the docker-compose.YAML file and add this is a line under the env tag:
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: 'true'
This should fix the issue
I'm deploy airflow with helm chart, but it should help.
First, you need content file values, command (helm chart)
helm show values apache-airflow/airflow > values.yaml
Find in file values: extraEnv, put the value below and save.
extraEnv: |
- name: AIRFLOW__WEBSERVER__EXPOSE_CONFIG
value: 'TRUE'
now, run changes with command below
helm upgrade --install airflow apache-airflow/airflow -n airflow -f values.yaml --debug
I just wanted to add that for "Azure bitnami Airflow multi-tier" implementation.
expose_config = True
in airflow.cfg and restart the web-server did the trick

Unable to LOAD_FILE in Maria DB

I am using Maria DB on Ubuntu 1804 :
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
I want to do something relatively easy and I have wasted 2 hours on it. I want to load a file as a string. There are several questions (many of them really old) on this site but none of them lead me to a solution and I have tested everything til reaching total frustration.
Granting privileges :
MariaDB [(none)]> GRANT FILE ON *.* TO matias#localhost;;
Query OK, 0 rows affected (0.00 sec)
ERROR: No query specified
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> SHOW GRANTS FOR matias#localhost
-> ;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for matias#localhost |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'matias'#'localhost' IDENTIFIED BY PASSWORD '*???' |
+------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
No secure_file_priv :
MariaDB [(none)]> SHOW VARIABLES LIKE 'secure_file_priv';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
1 row in set (0.00 sec)
Right permissions on the file :
[~]#Ubuntu1804 #> ls -lh test.txt
-rw-rw-r-- 1 matias matias 6 Feb 29 23:44 test.txt
And still cant get the file :
MariaDB [(none)]> SELECT USER();
+------------------+
| USER() |
+------------------+
| matias#localhost |
+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> SELECT LOAD_FILE('/home/matias/test.txt');
+------------------------------------+
| LOAD_FILE('/home/matias/test.txt') |
+------------------------------------+
| NULL |
+------------------------------------+
1 row in set (0.00 sec)
Can someone point me on the right direction to solve this?
Well, I tried EVERYTHING under the sun and it never worked.
So I tried with Ubuntu 19.10 instead of 18.04 and it works like charm,
so unless someone has some magic card on his sleeve this is the only workaround I could come up with.
All in all, it works in Ubuntu 16.04 and 19.10.

unixODBC Driver Manager "Data source name not found" even though it's actually there - MariaDB

I'm trying to set up an OBDC interface to two different MariaDB instances and I'm completely mystified by the fact that one works and the other doesn't.
One db ("platan") is running on a regular MariaDB installation on CentOS7 on 3306, whereas the other db ("tlex") is in a MariaDB instance inside a Docker container on the same OS and running on port 3301. I have to keep those two instances separate.
Both databases are reachable from the command line:
mysql -u mrtlex -pPASSWORD -h 127.0.0.1 -P3306 tlex
and
mysql -u platan -pPASSWORD -h 127.0.0.1 -P3301 platan
let me connect without a hitch.
I have the MariaDB driver defined in odbcinst.ini:
[MariaDB]
Description = MariaDB Connector/ODBC v.3.0
Driver64 = /usr/local/lib64/libmaodbc.so
And I have two data sources defined in odbc.ini:
[tlex]
Description = TLex dockerized
Driver = MariaDB
Database = tlex
Server = 127.0.0.1
Uid = mrtlex
Password = PASSWORD
Port = 3301
[platan]
Description = MariaDB localdb
Driver = MariaDB
Database = platan
Server = 127.0.0.1
Uid = platan
Password = PASSWORD
Port = 3306
odcbinst seems to recognize both datasources:
[root#CentOS-73-64-minimal ~]# odbcinst -q -s
[tlex]
[platan]
Yet I can actually connect only to platan and not the tlex datasource:
[root#CentOS-73-64-minimal ~]# iusql -v tlex
[unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLDriverConnect
[root#CentOS-73-64-minimal ~]# iusql -v platan
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
This doesn't make any sense to me. I can access both databases from the command line, both databases are set up the same way as ODBC datasources, both datasources as listed with odbcinst -q -s yet I can connect to only one of them through ODBC.
What could be the reason? How could I further troubleshoot this?
Many thanks in advance.
In order for a dockerized MariaDB to be accessible via ODBC, the container itself has to have unixODBC installed as well as the MariaDB ODBC driver and the data source file.

odbcinst: SQLGetPrivateProfileString failed with Unable to find component name

I am able to use unixodbc without any problem with my default user. But when I switch to another user, I get an error.
[centos# ~]$ odbcinst -q -s
[ODBC]
[Amazon Redshift DSN 32]
[centos# ~]$ su ruser
Password:
[ruser# centos]$ odbcinst -q -s
odbcinst: SQLGetPrivateProfileString failed with Unable to find component name.
Environment variables are set in both of the users:
AMAZONREDSHIFTODBCINI=/etc/amazon.redshiftodbc.ini
ODBCSYSINI=/usr/local/odbc
ODBCINI=/etc/odbc.ini
LD_LIBRARY_PATH=/usr/local/lib
LD_PRELOAD=/usr/local/lib/libodbcinst.so
Odbc configuration is as follows:
[ruser# centos]$ odbcinst -j
unixODBC 2.3.4
DRIVERS............: /usr/local/odbc /odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/odbc /odbc.ini
FILE DATA SOURCES..: /usr/local/odbc /ODBCDataSources
USER DATA SOURCES..: /etc/odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
By the way, I don't understand why there are spaces in the above paths. I don't know if there is a way to change them. Any ideas to solve this issue? Overall odbc configuration seems the same in both of the users.
I found the exact same issue on Centos, where I could use the default centos user to connect, but not any other users.
I was able to resolve the issue by copying the working user (or system) odbc.ini and odbcinst.ini files across into the home directory of the other user, like so (where I have renamed them to .odbc.ini and .odbcinst.ini respectively):
~/.odbc.ini
[MSSQLTest]
Driver = ODBC Driver 17 for SQL Server
Server = tcp:<ip of server>
~/.odbcinst.ini
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1
UsageCount=1
Finally, I just had to set the following environment variables inside my ~/.bashrc file, and I was able to connect.
export ODBCSYSINI="<full path to user folder, which would be the evaluated path of {echo ~}>"
export ODBCINSTINI=".odbcinst.ini"
export ODBCINI="<full path to user folder, which would be the evaluated path of {echo ~}>/.odbc.ini"
For some reason, I wasn't able to use ~ to reference the user folders, so I had to manually specify the full user path in the environment variables, and thus my complete .bashrc file is simply:
export ODBCSYSINI="/home/mitch"
export ODBCINSTINI=".odbcinst.ini"
export ODBCINI="/home/mitch/.odbc.ini"
With this setup, I could now run the following and connect successfully:
$ isql -v MSSQLTest <sql server username> <sql server password>
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

Wordpress and phpMyAdmin cannot open a RDS database

I created a WordPress multisite on an EC2 using CentOS 7 with MariaDB.
Amazingly it works.
I followed the instructions here
to upload the database
using MySQL from a command line I can attach to and see the RDS database.
MariaDB [(none)]> SHOW databases;
+--------------------+
| Database |
+--------------------+
| WPDB01 |
| information_schema |
| innodb |
| mysql |
| performance_schema |
+--------------------+
MariaDB [(none)]> select User, Host from mysql.user;
+-----------------+-----------+
| User | Host |
+-----------------+-----------+
| WordPressAbuser | % |
| WordPressUser | % |
| rdsadmin | localhost |
+-----------------+-----------+
So I know the ports are open and the database is there.
But changing localhost inside of wp-config.php to mymariadb.xyz.us-east-1.rds.amazonaws.com does not work.
What am I doing wrong?
Check if Your EC2 security group is attached to RDS security group?
check the below image of rds security group
Your RDS should have a new separate security group and in the source, you have to add ec2 security group.
that rds security group should be attached to you rds instance
the ec2 security group should attach to the corresponding ec2 instance
then try to connect

Resources