In
To read more about
- http://docs.grafana.org/features/datasources/mysql/#using-mysql-in-grafana
#mongodb #mongo #mysql #grafana #dashboard #chart
Grafana
if you are connected to MySQL
you need to provide 3 value in your select query. One is time which must be called time_sec
, the other is countable value which must be called value
and the other is the label that is displayed on your graph which must be called metric
:SELECT
UNIX_TIMESTAMP(your_date_field) as time_sec,
count(*) as value,
'your_label' as metric
FROM table
WHERE status='success'
GROUP BY your_date_field
ORDER BY your_date_field ASC
To read more about
Grafana
head over here:- http://docs.grafana.org/features/datasources/mysql/#using-mysql-in-grafana
#mongodb #mongo #mysql #grafana #dashboard #chart
https://dba.stackexchange.com/questions/41050/is-it-safe-to-delete-mysql-bin-files
#mysql #mysql_bin #bin #bin_file #purge
#mysql #mysql_bin #bin #bin_file #purge
Database Administrators Stack Exchange
Is it safe to delete mysql-bin files?
I have MM Replication in mysql, and I want to squeeze some free space in the box be deleting unnecessary files, I came across these mysql-bin files inside /var/db/mysql/ There are hundreds of those...
There is always a risk and also a problem when altering a production mySQL table.
Installation steps on Debian:
1- wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
2- sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
3- sudo apt-get update
4- sudo apt-get install percona-toolkit
Now you have percona toolkit on your Debian server. Use the command
#mysql #percona #schema #alter_table #online_schema_change #percona_toolkit #pt_online_schema_change
Percona
has released a toolkit that contains a command called pt-online-schema-change
. It will change table schema live on production without downtime.Installation steps on Debian:
1- wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
2- sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
3- sudo apt-get update
4- sudo apt-get install percona-toolkit
Now you have percona toolkit on your Debian server. Use the command
pt-online-schema-change
for your table alteration.#mysql #percona #schema #alter_table #online_schema_change #percona_toolkit #pt_online_schema_change
In order to dry run before the real execution use
Now after dry run you can execute the alter command:
#mysql #percona #schema #alter_table #online_schema_change #percona_toolkit #pt_online_schema_change
--dry-run
:pt-online-schema-change --dry-run h=127.0.0.1,D=YOUR_DB,t=YOUR_TABLE --alter "ADD COLUMN (foobar varchar(30) DEFAULT NULL);"
Now after dry run you can execute the alter command:
pt-online-schema-change --execute h=127.0.0.1,D=YOUR_DB,t=YOUR_TABLE --alter "ADD COLUMN (foobar varchar(30) DEFAULT NULL);"
#mysql #percona #schema #alter_table #online_schema_change #percona_toolkit #pt_online_schema_change
https://dba.stackexchange.com/questions/187630/problem-with-aborted-pt-online-schema-change-command
#mysql #trigger #percona #online_schema_change
#mysql #trigger #percona #online_schema_change
Database Administrators Stack Exchange
Problem with aborted PT-online-schema change command
I aborted a pt-online-schema change command to change a table definition. Now, when I run pt-online-schema change again, I get this error:
The table . has trigge...
The table . has trigge...
With
So be careful with it!
#mysql #mysqldump #port #port_ignorance #3306 #backup #database_backup #sockets #ip_address #localhost
mysqldump
you can export databases. with --port
parameter you can specify which port it should connects. If you provide localhost
for --host
parameter, mySQL will use sockets and port will be ignored.So be careful with it!
#mysql #mysqldump #port #port_ignorance #3306 #backup #database_backup #sockets #ip_address #localhost
Table compression in
https://dev.mysql.com/doc/refman/5.5/en/innodb-compression-usage.html
#database #mysql #compression #innodb
MySQL
:https://dev.mysql.com/doc/refman/5.5/en/innodb-compression-usage.html
#database #mysql #compression #innodb
If you have space problems on a server that hosts
In order to compress data on a table:
The output in my case squeezed data 4X:
After compression:
#mysql #innodb #compression #alter #row_format #compressed
MySQL
database, it's good idea to use compression. Make sure you are using InnoDB
storage engine.In order to compress data on a table:
alter table YOUR_DB_NAME.YOUR_TABLE_NAME ROW_FORMAT=COMPRESSED;
The output in my case squeezed data 4X:
ls -lh users.ibd | awk '{print $5}'
16G
After compression:
ls -lh users.ibd | awk '{print $5}'
3.9G
NOTE:
you have to use innodb_file_per_table
in your configuration. We have previously talked about this procedure step by step.#mysql #innodb #compression #alter #row_format #compressed