cPanel Config

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

mysql execute query from console and export to csv

Posted by copilas12

Hello. To dump a query to csv use this:

mysql  –database=database –execute=”select a from b where a>1;” | sed ’s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ > filename.csv
If you enjoyed this post, make sure you subscribe to my RSS feed!

mysqldump without locking tables

Posted by copilas12

Hello. I had a trouble some time ago: i wanted to dump a large table (38 million rows, 5G size) without locking the table because the website can’t go down. So, here is the mysqldump command:

mysqldump –skip-add-locks –skip-lock-tables database > database.sql
or for just a table:
mysqldump –skip-add-locks –skip-lock-tables database table > database.table.sql

Hope this help.
If you enjoyed [...]

Identifying slow MySQL queries

Posted by yolau

MySQL can sometimes create big problems on a server when you have users abusing it.
This article will teach you how to correctly identify the queries that are creating a problem for your server.

MySQL can log those queries that are taking longer then X seconds but this future is not turned on by default.
Here’s how you [...]

Importing/Exporting a mysql database

Posted by yolau

Although you can do a database import and/or export from phpMyAdmin there is a size limitation (defined in my.cnf max_allowed_packet) when you do an import, so the only solution is to import it from shell.
This article will show you how simple it is to do it.
Importing a mysql database

Login to your server as root or [...]

Install MySQL Performance Tuning Primer Script

Posted by yolau

Tuning the performance of MySQL can be a really hard job to do.
There are many thinks to consider and no two servers are identical so there is no universal solution.
Tuning Primer is a script that will help you tune your mysql installation by providing very healthy recommendations based on past mysql records.
For the script to [...]

Install mytop – top clone for MySQL

Posted by yolau

What is mytop?
mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x, and 4.x server. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed.
You will find more details on the homepage at http://jeremy.zawodny.com/mysql/mytop/
How to install

Download mytop
wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
Extract and change [...]