mysql-management

How to monitor MySQL space?

不想你离开。 提交于 2019-12-02 17:42:30
I downloaded a VM image of a web application that uses MySQL. How can I monitor its space consumption and know when additional space must be added? I have some great big queries to share: Run this to get the Total MySQL Data and Index Usage By Storage Engine SELECT IFNULL(B.engine,'Total') "Storage Engine", CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", CONCAT(LPAD(REPLACE( FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Index Size", CONCAT(LPAD(REPLACE( FORMAT(B.TSize/POWER(1024,pw),3),','

mysql command for showing current configuration variables

﹥>﹥吖頭↗ 提交于 2019-12-02 14:20:12
Can not find a command that displays the current configuration of mysql from within the database. I know I could look at /etc/mysql/my.cnf but that is not what I need. code_burgar What you are looking for is this: SHOW VARIABLES; You can modify it further like any query: SHOW VARIABLES LIKE '%max%'; Use SHOW VARIABLES : show variables like 'version'; As an alternative you can also query the information_schema database and retrieve the data from the global_variables (and global_status of course too). This approach provides the same information, but gives you the opportunity to do more with the

How to make mysql accept connections externally

时间秒杀一切 提交于 2019-12-01 00:05:40
I have a VPS and I want to make mysql DB accept connection externally (from my PC for instance). I have Debian Linux installed on the server. I checked some tutorials online and they said to comment out: bind-address = 127.0.0.1 But this didn't seem to help! is there anything specific for VPSs? or Am I missing something else? The command that runs mysql is: /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock The MySQL server must be configured to accept connections

Can you apply LIMIT on MySQL before LEFT JOIN another?

為{幸葍}努か 提交于 2019-11-30 18:01:37
For example: SELECT * FROM table_1 LIMIT 5 LEFT JOIN table_2 AS table_1.id = table_2.id WHERE 1 Otherwise the engine takes all of table_1 before applying the join, then limiting which can slow the query down massively (with massive tables). You can do it by joining on a subquery instead of an actual table. Something like this should work: SELECT * FROM (SELECT * FROM table_1 LIMIT 5) as subq LEFT JOIN table_2 ON subq.id = table_2.id WHERE 1 来源: https://stackoverflow.com/questions/7405432/can-you-apply-limit-on-mysql-before-left-join-another

Autocomplete in MySQL under Windows

随声附和 提交于 2019-11-30 13:45:48
Does anybody know if there is a way to make autocompletion work in MySQL Command Line Client under Windows? It's working nicely under Linux for me, but simply moves the cursor under Windows instead. It ought to work this way: C:\> mysql --auto-rehash Or configure your my.cnf: [mysql] auto-rehash edit: My apologies. I have found some references that the tab-completion feature in mysql client works only on UNIX/Linux. It does not work on Windows. update: The reason for this is mentioned briefly in MySQL bug #4731 : [31 Jul 2004 12:47] Sergei Golubchik I just downloaded 4.0.15 - command

Mysql - Rename all tables and columns to lower case?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 07:20:16
I recently transferred a database from a windows box to a linux box. The tables are mixed between lower and upper case names. I need a way to rename all tables and columns to lowercase. Is that possible? I see in this SO answer it's possible for tables, but have not found anything that deals with column names. user194076 You can try to do exact same thing with Information_Schema.Columns table EDIT: Something like SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE `', COLUMN_NAME, '` `', LOWER(COLUMN_NAME), '` ', COLUMN_TYPE, ';') FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{your

Can you apply LIMIT on MySQL before LEFT JOIN another?

梦想与她 提交于 2019-11-30 01:45:19
问题 For example: SELECT * FROM table_1 LIMIT 5 LEFT JOIN table_2 AS table_1.id = table_2.id WHERE 1 Otherwise the engine takes all of table_1 before applying the join, then limiting which can slow the query down massively (with massive tables). 回答1: You can do it by joining on a subquery instead of an actual table. Something like this should work: SELECT * FROM (SELECT * FROM table_1 LIMIT 5) as subq LEFT JOIN table_2 ON subq.id = table_2.id WHERE 1 来源: https://stackoverflow.com/questions/7405432

Can't create MySQL trigger with TRIGGER privilege on 5.1.32

▼魔方 西西 提交于 2019-11-30 01:39:00
问题 My fellow developers and I have our own development schemas on a shared MySQL development database. My assignment requires me to create triggers in my schema, yet I've been unsuccessful so far. CREATE TRIGGER myTrigger AFTER DELETE on myTable FOR EACH ROW BEGIN -- DO STUFF END; MySQL says: ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable) I checked the MySQL manual (http://dev

Autocomplete in MySQL under Windows

情到浓时终转凉″ 提交于 2019-11-29 18:38:19
问题 Does anybody know if there is a way to make autocompletion work in MySQL Command Line Client under Windows? It's working nicely under Linux for me, but simply moves the cursor under Windows instead. 回答1: It ought to work this way: C:\> mysql --auto-rehash Or configure your my.cnf: [mysql] auto-rehash edit: My apologies. I have found some references that the tab-completion feature in mysql client works only on UNIX/Linux. It does not work on Windows. update: The reason for this is mentioned

MySQL server's thread_stack parameter - what is it? How big should it be?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 09:28:05
Couple days ago I got following error from MySQL database: Thread stack overrun: 68744 bytes used of a 196608 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack. All documentation that I found says, that: The default is 64KB before MySQL 4.0.10 and 192KB thereafter. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions. I set the variable thread_stack to 256K, but it was just a random value. For now it solved the