Skip to content
Home » mariadb

mariadb

Visit Tacticalware.com for information related to this tag and others. We look forward to assisting in your tech projects with our in-depth knowledgebase…

COMBINE MULTIPLE CSV FILES FROM THE COMMAND LINE AND RETAIN FILENAMES

For this guide we will take thousands of csv files and combine them into One single file, which will be uploaded to a database. This file will have a new column inserted, where the originating filename will be added next to the row. In scraping sites, often my output files are separated and after I clean them up I need to combine them. This is how I do it.

On my Windows 10 computer
I will copy my CSV files over to a secondary drive, leaving the originals intact.
Then I will open a command prompt as an administrator and navigate to that drive. If the files are on my H: drive will navigate by typing
H:
Then press Enter

Now I will navigate to the “dataset” folder
cd dataset

I will then list the directory contents to ensure this holds my csv files
dir

Once I see all of my csv files I will enter the following:

for /f %a in ('dir /b *.csv') do for /f "tokens=*" %b in (%a) do echo %b,%a >> combined-date.csv

Then press Enter

This will create a file called combined-04132021.csv (which is today’s date)

And I can then upload that file to my database easily

“MySQL: Host ‘IP’ is not allowed to connect to this MariaDB server”

If you are trying to connect Power BI to a Mysql/MariaDB server and receive the error “MySQL: Host ‘IP’ is not allowed to connect to this MariaDB server” perform the following

Login into the server via ssh

sudo bash

mysql -u root -p

Enter your mysql password

Type in the following:

CREATE USER 'newusernamehere'@'localhost' IDENTIFIED BY 'newpassword';
GRANT ALL PRIVILEGES ON *.* TO 'newusernamehere'@'localhost' WITH GRANT OPTION;
CREATE USER 'newusernamehere'@'%' IDENTIFIED BY 'newpassword';
GRANT ALL PRIVILEGES ON *.* TO 'newusernamehere'@'%' WITH GRANT OPTION;

Now retry your connection in Power BI using the new user and password you specified above

PHPMYADMIN ERROR:

The error is as follows:
“The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
Or alternately go to ‘Operations’ tab of any database to set it up there.”

When you click Find Out Why, you see this message
Create a database named ‘phpmyadmin’ and setup the phpMyAdmin configuration storage there.

To solve this, in PHPMYADMIN
Create a new database named phpmyadmin

Click on the PHPMYADMIN logo at the top left to go back to the home page

Click on the Find Out Why

Click Create on the line that says “Create a database named ‘phpmyadmin’ and setup the phpMyAdmin configuration storage there.

The database will setup now

And the error will be fixed