I was getting the same error but I wasn't willing to shorten my SKUs. So what I did was change the default sku length across the system to 255.
Specifically, the changes I made are:
Magento code: Change const SKU_MAX_LENGTH = 64 to const SKU_MAX_LENGTH = 255 in the file: module-catalog/Model/Product/Attribute/Backend/Sku.php
Database: Ran the following ...
In new version of Magento, export option was moved to queue
if you want to start this services then we have to run the services.
use below cmd to start the services
php bin/magento queue:consumers:start exportProcessor
if you want to run in background then append & that is
php bin/magento queue:consumers:start exportProcessor &
you can use the code below to add the category names in separate columns in csv file, just modified your code a bit.
$products = Mage::getModel('catalog/product')->getCollection();