Showing posts with label MySQL L1. Show all posts
Showing posts with label MySQL L1. Show all posts

Apr 9, 2022

cmd or powershell command output into a file

 

In CMD 

YOUR-COMMAND > C:\PATH\TO\FOLDER\OUTPUT.txt

In Powershell 


YOUR-COMMAND | Out-File -FilePath C:\PATH\TO\FOLDER\OUTPUT.txt

Feb 15, 2022

Enable Data Load Local InFile

We were getting below error at the time of loading data into MySQL. 

Error: Programming Error: 3948 (42000): Loading local data is disabled; this must be enabled on both the client and server sides.


Solution: 

Check the status of local_infile variable in MySQL...

> show variables like '%local%';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| local_infile  | OFF    |

+---------------+-------+

In our care it was off. We solved this problem with the MySQL terminal command...

> SET GLOBAL local_infile = true;


Check the status now..

> show variables like '%local%';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| local_infile  | ON   |

+---------------+-------+

Feb 10, 2022

Slow query log purge in MySQL

There are manly 3 steps...

1. Rename existing log file with _old.

2. Connect mysqladmin using socket and use  flush-logs.

3. Delete _old file created in first step.

 

Get the show query log location:

mysql> show variables like slow_query_log %';

Get the socket file location:

mysql> show variables like 'socket%';

In my case I got the info like below…

/u01/app/logs/DB_instance/slow-query-DB_instance.log

/var/run/DB_Instance/DB_instance.sock

Now go to the Log location and renaming slow query file…

mv slow-query-DB_instance.log slow-query- DB_instance.log_old 

 

Flush-log using mysqladmin

/u01/app/mysql80/bin/mysqladmin  flush-logs --socket=/var/run/DB_Instance/ DB_Instance.sock

You can check show query log file. There will be a new log file.

Now delete old log file

rm slow-query-DB_Instance.log_old

 

All set....