Các lệnh mysql
1. Show current database is selected:
SELECT DATABASE() FROM DUAL;
2. Import/Export mysql
https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql
Note:
a. Tránh lock bảng
--lock-tables=false --compact
b. Sử dụng lệnh source để xem kết quả import trên từng dòng
https://dev.mysql.com/doc/refman/5.7/en/mysql-batch-commands.html
Note:
a. Tránh lock bảng
--lock-tables=false --compact
b. Sử dụng lệnh source để xem kết quả import trên từng dòng
https://dev.mysql.com/doc/refman/5.7/en/mysql-batch-commands.html
3. View a list of mysql users and their privileges
http://xmodulo.com/how-to-view-list-of-mysql-users-and-their-privileges.html
- To get a list of MySQL users
mysql> select user,host from mysql.user;
4. size of tables
You can use this query to show the size of a table (although you need to substitute the variables first):SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM information_schema.TABLES WHERE table_schema = "$DB_NAME" AND table_name = "$TABLE_NAME";
or this query to list the size of every table in every database, largest first:SELECT table_schema as `Database`, table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM information_schema.TABLES ORDER BY (data_length + index_length) DESC;
Không có nhận xét nào:
Đăng nhận xét