Magento how to check whether SSL redirection is enabled using MySQL command line and disable it if needed

To check whether SSL redirection is enabled or disabled in Magento using MySQL command line, you can execute the following SQL query:

SELECT * FROM core_config_data WHERE path LIKE '%web/secure/use_rewrites%';

If the value of the value column is set to 1, then SSL redirection is enabled.… Read the rest

How to create database, database username and grant all rights on cPanel server via command line using UAPI

You can create a database, database user, and grant privileges using the cPanel User API (UAPI) command line interface.

Connect to your cPanel account using SSH.

Type the following command to create a new database:

uapi --user='cpanel_username' Mysql create_database name='database_name'

Replace ‘cpanel_username‘ with your cPanel account username and ‘database_name‘ with the name of the database you want to create.… Read the rest

How to calculate innodb_buffer_pool_size value

Run to the following command to start calculation:

SELECT CEILING(Total_InnoDB_Bytes*1.6/POWER(1024,3)) RIBPS FROM
(SELECT SUM(data_length+index_length) Total_InnoDB_Bytes
FROM information_schema.tables WHERE engine='InnoDB') A;

Example:

mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 60295069
Server version: 10.3.34-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Read the rest

How to check if JSON_ARRAYAGG supported

Run the following simple query

with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;

Example:

MariaDB [(none)]> with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;
+-----------------+------+
| version() | j |
+-----------------+------+
| 10.5.13-MariaDB | NULL |
+-----------------+------+
1 row in set (0.002 sec)

If it doesn’t support you should get:

MariaDB [(none)]> with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;
ERROR 1305 (42000): FUNCTION JSON_ARRAYAGG does not exist

 

Source: https://mariadb.com/kb/en/json_arrayagg/… Read the rest

How to fix a login issue after WordPress Multisite split

The slave installation will lose users

wp user list

+—-+————+————–+————+—————–+——-+
| ID | user_login | display_name | user_email | user_registered | roles |
+—-+————+————–+————+—————–+——-+
+—-+————+————–+————+—————–+——-+

And you won’t be able to create new admin user because you don’t have appropriate MySQL tables

wp user create admin [email protected]
Read the rest

How to enable Slow Query Log

Append into /etc/my.cnf the following:

slow_query_log = 1
slow-query_log_file = /var/log/mysql-slow.log
long_query_time = 2

Create /var/log/mysql-slow.log log file and set it as mysql user:

touch /var/log/mysql-slow.log
chown mysql:mysql /var/log/mysql-slow.log

Restart MySQL server:

/scripts/restartsrv_mysql

Monitor the logs using tail command:

tail -f /var/log/mysql-slow.log
Read the rest

Mysqldump error: The user specified as a definer does not exist

Error:

mysqldump myuser_db > myuser_db.sql

mysqldump: Got error: 1449: “The user specified as a definer (‘user_db’@’localhost’) does not exist” when using LOCK TABLES

To pass this error try to use –single-transaction

mysqldump --single-transaction myuser_db > myuser_db.sql

Should be good now

Source: https://stackoverflow.com/questions/26583103/mysqldump-got-error-1449/26583311Read the rest