WaZaRWiki : MySQLTips

GaelReignier :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register :: Hosted by: eNiX

Revision [36416]

Most recent edit made on 2011-08-22 14:28:33 by GaelReignier

Additions:

Date management

now() - interval 10 day
CURDATE() + INTERVAL 1 DAY




Revision [2998]

Edited on 2010-11-24 17:19:50 by GaelReignier

Additions:
Configure user to monitor things with Nagios for instance:
grant usage, super on *.* to "monitoring_user"@"W.X.Y.Z" identified by "xyz";




Revision [381]

Edited on 2010-04-13 13:31:34 by GaelReignier

Additions:
Configure user for Cacti monitoring:
GRANT PROCESS ON *.* TO cacti@'cactimachine' IDENTIFIED by 'cactipasswd';
GRANT SUPER ON *.* TO cacti@%'cactimachine' IDENTIFIED BY 'cactipasswd';




Revision [374]

Edited on 2010-03-03 18:26:12 by GaelReignier

Additions:
Configure user for replication:
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '<some_password>';
FLUSH PRIVILEGES;




Revision [373]

Edited on 2010-03-03 12:54:54 by GaelReignier

Additions:
Configure user for backup:
grant select, lock tables, show view on *.* to 'backup'@'localhost' identified by 'some password';




Revision [372]

Edited on 2010-02-26 12:28:32 by GaelReignier

Additions:
Displays information about users http://dev.mysql.com/doc/refman/5.0/en/show-grants.html
show grants
Configure user for monitoring replication:
grant replication client on *.* to 'username'@'localhost' identified by 'XYZ';


Deletions:
show grants: displays information about users http://dev.mysql.com/doc/refman/5.0/en/show-grants.html




Revision [371]

Edited on 2010-02-25 14:50:25 by GaelReignier

Additions:

Database variable monitoring

show variables;
show gloabal variables;
show global status;




Revision [355]

Edited on 2010-01-19 12:47:21 by GaelReignier

Additions:

Disk usage patterns

This link is a really good overview of the type of files that are handled by MySQL: http://yoshinorimatsunobu.blogspot.com/2009/05/tables-on-ssd-redobinlogsystem.html
Random i/o oriented:
Sequential write oriented:




Revision [330]

Edited on 2009-07-28 17:06:50 by GaelReignier

Additions:

Tuning

key_buffer
max_allowed_packet
thread_stack
read_rnd_buffer_size
key_buffer is only allocated once, when the DB starts
max_allowed_packet (size of the packet created for each query), thread_stack, read_rnd_buffer_size are allocated for every connection to your DB server.
So from max_allowed_packet, thread_stack and read_rnd_buffer_size you can get the max number of connection to your db.
To do so, you need to divide the total amount of RAM you have by the sum of those 3 figures.




Revision [261]

Edited on 2008-12-18 14:35:10 by GaelReignier

Additions:
Select "MyValue" as source, tableName.*
From tableName;
SELECT *
FROM mother_of_all_searches
WHERE particulars_id = 'X'
OR particulars_id = 'Y'
OR particulars_id = 'Z';
select table_schema 'intranet' , sum(data_length+index_length)/1024/1024 'db size in MB'
from tables
group by table_schema;


Deletions:
Select "MyValue" as source, tableName.* from tableName;
SELECT * FROM mother_of_all_searches WHERE particulars_id = 'X' OR particulars_id = 'Y' OR particulars_id = 'Z';
select table_schema 'intranet' , sum(data_length+index_length)/1024/1024 'db size in MB' from tables group by table_schema;




Revision [260]

Edited on 2008-12-18 14:34:33 by GaelReignier

Deletions:
(language-ref)
(MySQL)




Revision [259]

Edited on 2008-12-18 14:34:11 by GaelReignier

Additions:
%%(mysql)




Revision [248]

Edited on 2008-12-18 13:37:41 by GaelReignier

Additions:

Get the size of your databases

%%(MySQL)
select table_schema 'intranet' , sum(data_length+index_length)/1024/1024 'db size in MB' from tables group by table_schema;




Revision [194]

Edited on 2008-08-20 18:39:16 by GaelReignier

Additions:

Get mysql version

select version();




Revision [171]

Edited on 2008-07-22 19:37:45 by GaelReignier

Additions:

Get a specific number of charactere from a select statement

Create a table from another one

CREATE TABLE mother_of_all_results AS
SELECT * FROM mother_of_all_searches WHERE particulars_id = 'X' OR particulars_id = 'Y' OR particulars_id = 'Z';


Deletions:
Get a specific number of charactere from a select statement




Revision [170]

Edited on 2008-07-22 19:35:59 by GaelReignier

Additions:

mysqldump:

Add a specific column in a select statement filled with the same value:

Select "MyValue" as source, tableName.* from tableName;

Source: will be the column title and it will be filled with "MyValue" for all the results
Get a specific number of charactere from a select statement
SELECT SUBSTRING(mother_of_all_results.source FROM 3 FOR 10) AS username, mother_of_all_results.*
FROM mother_of_all_results;


Deletions:
mysqldump:




Revision [168]

Edited on 2008-07-18 18:06:29 by GaelReignier

Additions:
mysqldump:
1 insert per line: use the option: --skip-extended-insert




Revision [109]

The oldest known version of this page was edited on 2008-06-02 17:09:22 by GaelReignier
ITTips



User management:

show grants: displays information about users http://dev.mysql.com/doc/refman/5.0/en/show-grants.html
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0779 seconds