How to get the sizes of the tables of a mysql database.

You can use this query :

mysql> select table_name as 'Table', round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
from information_schema.tables where table_schema = 'database' and table_name = 'log';
+----------+------------+
| Table    | Size in MB |
+----------+------------+
| log      |    2357.02 |
+----------+------------+
1 row in set (0.00 sec)

mysql> 

“How to get the sizes of the tables of a mysql database.”Continue reading

Mysql: import and export

Экспорт и импорт данных в MySQL обычно требуется при переносе информации из одной базы данных MySQL в другую и для осуществления резервного копирования.
Резервное копирование данных носит чисто технологический характер. Это означает, что в случае какого-либо программного или аппаратного сбоя оборудования, будет возможность восстановить актуальные данные.
Единственный способ быть уверенным в 100% восстановлении данных — самостоятельно выполнять регулярное резервное копирование информации. Для этого необходимо воспользоваться утилитой mysqldump, которая доступна через unix shell.

Пример команд для экспорта и импорта базы данных:

mysqldump -u имя_пользователя -p -h имя_сервера_БД имя_базы > dump.sql

“Mysql: import and export”Continue reading

automysqlbackup: Unknown table engine ‘PERFORMANCE_SCHEMA’

This error seems to be related to the MySQL-Bug #58406 (status: verified).

For the moment, you can ignore that message. The process skips the table and continues as always.
Whatever, if you want to make sure that your database has not been corrupted in consequence of this error, simply force mysqldump to ignore all performance_schema-tables.

Plesk way:

“automysqlbackup: Unknown table engine ‘PERFORMANCE_SCHEMA’”Continue reading

Shell way: Adding new user(s) to MySQL Databases.

This small tip shows how to add new users to a MySQL system and keep their databases seperate from each other.

If you have a server of your own it makes a lot of sense to replicate this setup – for each database application you wish to use create a specific database to hold its data and create a dedicated user to access it.

“Shell way: Adding new user(s) to MySQL Databases.”Continue reading

ERRORS REPORTED: mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user ‘root’@’localhost’ for table ‘cond_instances’ when using LOCK TABL

  • Add –skip-add-locks(–skip-lock-tables) to your mysqldump command
  • For automysqlbackup on Debian:
    Edit the automysqlbackup executable.
    Modify the function dbdump.
    Add the –skip-lock-tables.
    “ERRORS REPORTED: mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user ‘root’@’localhost’ for table ‘cond_instances’ when using LOCK TABL”Continue reading
Scroll to top