Archive for the ‘MySQL’ Category

Mysql SHOW syntax

This item was filled under [ MySQL ]

SHOW CHARACTER SET [like_or_where]
SHOW COLLATION [like_or_where]
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]
SHOW CREATE DATABASE db_name
SHOW CREATE FUNCTION func_name
SHOW CREATE PROCEDURE proc_name
SHOW CREATE TABLE tbl_name
SHOW DATABASES [like_or_where]
SHOW ENGINE engine_name {LOGS | STATUS }
SHOW [STORAGE] ENGINES
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW FUNCTION CODE func_name
SHOW FUNCTION STATUS [like_or_where]
SHOW GRANTS FOR user
SHOW INDEX FROM tbl_name [FROM db_name]
SHOW INNODB STATUS
SHOW [...]

Continue reading...

Tagged with: [ , , ]

Optimize MySQL

This item was filled under [ MySQL ]

When MySQL uses indexes
Using >, >=, =, <, <=, IF NULL and BETWEEN on a key.
SELECT * FROM `table_name` WHERE `key_part1` = 1 AND `key_part2` > 5;
SELECT * FROM `table_name` WHERE `key_part1` IS NULL;
When you use a LIKE that doesn’t start with a wildcard.
SELECT * FROM `table_name` WHERE `key_part1` LIKE ‘jani%’
Retrieving rows from [...]

Continue reading...

5 Useful MySQL Functions And Control Flows

This item was filled under [ MySQL ]

1: IF()
If statements have been a life saver on many occasions. They are invaluable for checking a value then returning another value different from the one stored in the table.
sql Code:

SELECT
IF(myColumn1 = 1, ‘Yes’, ‘No’) AS myIfColumn
FROM
myTable

Result: If myColumn1 equals 1 then Yes else No.
2: ELT()
Similar to an if else statement. The ELT takes the [...]

Continue reading...

Tagged with: [ , , , ]

File system security (access rights)

This item was filled under [ Linux, MySQL ]

In your unixstuff directory, type
% ls -l (l for long listing!)
You will see that you now get lots of details about the contents of your directory, similar to the example below.

Each file (and directory) has associated access rights, which may be found by typing ls -l. Also, ls -lg [...]

Continue reading...

Tagged with: [ , , , ]
Update me when site is updated