How to speed up slow Magento indexer process? Maria DB 10.4

Category Products index taking too much time? bin/magento index:reset bin/magento index:reindex Stuck at category products index … Here is the solution if you are using MariaDB 10.4 You need to update options/parameters for your db. If using RDS, edit “DB instance parameter group” that you are using and update these 2 values: optimizer_switch='rowid_filter=off' optimizer_use_condition_selectivity = 1 After these changes, restart your database. In aws, RDS automatically updates these parameters without any downtime or requirement for restarting. You will see noticeable difference in indexer time. ...

September 8, 2023 · 1 min · Harshvardhan Malpani

How to export multiple selected tables in PMA phpmyadmin (but not all tables)

Click on export, and choose “custom” export method. Lets say you want to export first 20 tables only. Open chrome or browser console [ctrl+shift+j], enter the following: $("input[name='table_data[]']").slice(0,20).click(); For next 20, use 20,50 as arguments in slice function used above.

May 25, 2021 · 1 min · Harshvardhan Malpani

How to solve MySQL server gone away error Maria Db update on cPanel and WHM?

This is related to new MariaDb upgrade from 10.1.41 to 10.1.42 and also for servers which were updated from 10.2.27 to 10.2.28 Go to solution ( Special Thanks to @Valetia ) You will see errors in following formats/messages: No file or input found MySQL Server has gone away Connection to MySQL Server failed sqlstate[hy000]: general error: 2013 lost connection to mysql server during query General error: 2006 MySQL server has gone away ERROR 2006 (HY000): MySQL server has gone away ERROR 2013 (HY000): Lost connection to MySQL server during query Log files (/var/lib/mysql/$hostname.err) will have or can have any of these errors: ...

November 6, 2019 · 1 min · Harshvardhan Malpani

How to change attribute dropdown type to multi-select in Magento 2?

Short Answer: Not possible via Magento2 Admin Backend. Solution: You need to update eav_attribute table and edit information about backend_source, frontend_input etc. Simple query for that is: UPDATE `eav_attribute` SET `backend_model`="Magento\\\Eav\\\Model\\\Entity\\\Attribute\\\Backend\\\ArrayBackend", `backend_type`="varchar", `frontend_input`="multiselect", `source_model`=NULL WHERE `attribute_id`=YOUR_ATTRIBUTE_ID_INTEGER LIMIT 1 Replace YOUR_ATTRIBUTE_ID_INTEGER with your attribute_id like 355 Reference: https://stackoverflow.com/a/57701845/2229148

August 29, 2019 · 1 min · Harshvardhan Malpani

How to wipe all the tables and data in MySQL? Clean whole database

SET FOREIGN_KEY_CHECKS = 0; SET GROUP_CONCAT_MAX_LEN=32768; SET @tables = NULL; SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables FROM information_schema.tables WHERE table_schema = (SELECT DATABASE()); SELECT IFNULL(@tables,'dummy') INTO @tables; SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET FOREIGN_KEY_CHECKS = 1; Will not work via phpmyadmin or any script. this has to be run in cmd/terminal Quick Command wget https://gist.githubusercontent.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac/raw/ce04b319bf1594d148d3346e1474119fe1cd1b3f/flushdb.sql mysql -hYOUR_DATABASE_HOSTNAME -uYOUR_DATABASE_USER -p YOUR_DATABASE_NAME < flushdb.sql *Source:* https://gist.github.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac

August 3, 2019 · 1 min · Harshvardhan Malpani

How to reverse the ids in a mysql table column without breaking primary key constraint?

Let me explain the problem scenario: Let us assume we have a table with 4 columns in it out of which 1 is PRIMARY column and rest 3 contain some data. What we want to do is to reverse the primary key IDs for that data keeping the rest of data intact. It is like shifting the first row to end and moving last row to starting. Initial Data id name email anything 1 jacob whatever how to reverse 3 nathan whosoeverisnathan ids in mysql table column 4 jagmohan idontknowjagmohan without breaking 8 monica iamsexy primary key constraint 9 batman idontexistinrealworld i am batman Data after update id name email anything 9 jacob whatever how to reverse 8 nathan whosoeverisnathan ids in mysql table column 4 jagmohan idontknowjagmohan without breaking 3 monica iamsexy primary key constraint 1 batman idontexistinrealworld i am batman Dude, you are just reversing the column, what is so tough in this? So, this seems simple to reverse an array if isolated by key “id“. But you have to understand that this column is the primary key. So if you run a command to change id for “jacob” to “9“. It will give you error: “Duplicate entry for id 9“ ...

June 1, 2019 · 2 min · Harshvardhan Malpani

Some of the most important SQL commands.

SQL, Structured Query Language, is a programming language designed to manage data stored in relational databases. SQL operates through simple, declarative statements. This keeps data accurate and secure, and it helps maintain the integrity of databases, regardless of size. Most of the actions you need to perform on a database are done with SQL statements. SQL commands are grouped into four major categories depending on their functionality: Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control Language (TCL) Data Control Language (DCL) COMMANDS: SELECT SELECT column_name FROM table_name; SELECT statements are used to fetch data from a database ( extracts data from a database ). Every query will begin with SELECT. ...

January 24, 2019 · 2 min · Harshvardhan Malpani

Creating a table in PhpMyAdmin Xampp server.

Hello People. In this post we will discuss that how you can create a table in phpmyadmin xampp server for your php project. Before creating a table first you must create a database, because without database you can not create a table. steps to create a table in phpmyadmin. Start your Xampp server and open the following link in your browser. localhost/phpmyadmin . Now click on the New button. ...

January 16, 2019 · 1 min · Harshvardhan Malpani

Connection timeout with MySQL database.

MySQL disconnects automatically after some time. If you experience MySQL timeouts, it could be due to heavy or very long MySQL queries. You can try using mysql_reconnect command before every query, and it should be fine. MySQL server timeout can occur for many reasons but most commonly it is caused by either an application bug, a network timeout issue, or due to the MySQL server restarting. These steps could solve the issue. (By setting no time to MySQl.) ...

January 8, 2019 · 1 min · Harshvardhan Malpani

How to repair a MySQL database?

Hello! Good to see you. This is going to be a very important article because we are about to discuss “How to repair a MySQL database?” Why repair MySQL Database? Databases can become corrupted for any number of reasons, from software defects to hardware issues. If this occurs, you can try to repair the database. Wondering how to do it? Just follow this article. REPAIRING MYSQL DATABASES: Let’s see how to repair MySQL database through Linux and Windows command line. ...

October 30, 2018 · 2 min · Harshvardhan Malpani