Difference between revisions of "Database"

From Things and Stuff Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
== MySQL ==
 
== MySQL ==
 
* [http://dev.mysql.com/doc/ MySQL Reference Manuals]
 
* [http://dev.mysql.com/doc/ MySQL Reference Manuals]
** [http://dev.mysql.com/doc/refman/5.1/en/mysqld.html 4.3.1. mysqld — The MySQL Server]
+
** [http://dev.mysql.com/doc/refman/5.6/en/mysqld.html 4.3.1. mysqld — The MySQL Server]
** [http://dev.mysql.com/doc/refman/5.0/en/mysqlbinlog.html 4.6.7. mysqlbinlog] — Utility for Processing Binary Log Files
+
** [http://dev.mysql.com/doc/refman/5.6/en/mysqlbinlog.html 4.6.7. mysqlbinlog] — Utility for Processing Binary Log Files
** [http://dev.mysql.com/doc/refman/4.1/en/server-options.html 5.1.2. Server Command Options]
+
** [http://dev.mysql.com/doc/refman/5.6/en/server-options.html 5.1.2. Server Command Options]
** [http://dev.mysql.com/doc/refman/4.1/en/server-logs.html 5.3. MySQL Server Logs]
+
** [http://dev.mysql.com/doc/refman/5.6/en/server-logs.html 5.3. MySQL Server Logs]
*** [http://dev.mysql.com/doc/refman/4.1/en/error-log.html 5.3.1. The Error Log]
+
*** [http://dev.mysql.com/doc/refman/5.6/en/error-log.html 5.3.1. The Error Log]
** [http://dev.mysql.com/doc/refman/5.0/en/privilege-system.html 6.2. The MySQL Access Privilege System]
 
*** [http://dev.mysql.com/doc/refman/5.0/en/privilege-changes.html 6.2.6. When Privilege Changes Take Effect]
 
*** [http://dev.mysql.com/doc/refman/5.1/en/access-denied.html 6.2.7. Causes of Access-Denied Errors]
 
*** [http://dev.mysql.com/doc/refman/5.0/en/assigning-passwords.html 6.3.5. Assigning Account Passwords]
 
** [http://dev.mysql.com/doc/refman/5.5/en/grant.html 13.7.1.3. GRANT Syntax]
 
** [http://dev.mysql.com/doc/refman/5.0/en/show-grants.html 13.7.5.17. SHOW GRANTS Syntax]
 
** [http://dev.mysql.com/doc/refman/5.0/en/flush.html 13.7.6.2. FLUSH Syntax]
 
** [http://dev.mysql.com/doc/refman/5.0/en/describe.html 13.8.1. DESCRIBE Syntax]
 
** [http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html C.5.4.1. How to Reset the Root Password]
 
  
* [http://kb.askmonty.org/en/ MariaDB Knowledge Base]
+
** [http://dev.mysql.com/doc/refman/5.6/en/privilege-system.html 6.2. The MySQL Access Privilege System]
 +
*** [http://dev.mysql.com/doc/refman/5.6/en/privilege-changes.html 6.2.6. When Privilege Changes Take Effect]
 +
*** [http://dev.mysql.com/doc/refman/5.6/en/access-denied.html 6.2.7. Causes of Access-Denied Errors]
 +
* [http://hashmysql.org/wiki/Remote_Clients_Cannot_Connect Remote Clients Cannot Connect] - #mysql wiki
  
* http://kb.askmonty.org/en/using-mysqlbinlog
+
*** [http://dev.mysql.com/doc/refman/5.6/en/assigning-passwords.html 6.3.5. Assigning Account Passwords]
  
* http://hashmysql.org/wiki/Remote_Clients_Cannot_Connect
+
** [http://dev.mysql.com/doc/refman/5.6/en/describe.html 13.8.1. DESCRIBE Syntax]
 +
** [http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html C.5.4.1. How to Reset the Root Password]
  
 
=== Commands ===
 
=== Commands ===
 
* http://www.pantz.org/software/mysql/mysqlcommands.html
 
* http://www.pantz.org/software/mysql/mysqlcommands.html
  
  show databases;
+
  http://dev.mysql.com/doc/refman/5.6/en/create-user.html
 
 
use [db name];
 
  
 +
[http://dev.mysql.com/doc/refman/5.6/en/show.html show] databases;
 
  show tables;
 
  show tables;
 +
 +
[http://dev.mysql.com/doc/refman/5.6/en/use.html use] [db name];
 +
 +
[http://dev.mysql.com/doc/refman/5.6/en/flush.html flush] privileges;
  
  flush privileges;
+
  [http://dev.mysql.com/doc/refman/5.6/en/grant.html grant] all on userdatabase.* TO 'username'; [http://www.softwareprojects.com/resources/programming/t-how-to-restrict-mysql-user-access-to-a-single-datab-1734.html]
 
+
GRANT ALL ON USERDATABASE.* TO 'USERNAME'; [http://www.softwareprojects.com/resources/programming/t-how-to-restrict-mysql-user-access-to-a-single-datab-1734.html]
+
[http://dev.mysql.com/doc/refman/5.6/en/show-grants.html 13.7.5.17. SHOW GRANTS Syntax]
  
 
Create command list for showing user grants [http://www.pythian.com/news/1165/creative-sql-how-to-easily-show-grants-for-many-users/]
 
Create command list for showing user grants [http://www.pythian.com/news/1165/creative-sql-how-to-easily-show-grants-for-many-users/]
 
  SELECT CONCAT("SHOW GRANTS FOR '",user,"'@'",host,"';") FROM mysql.user WHERE host!='localhost';
 
  SELECT CONCAT("SHOW GRANTS FOR '",user,"'@'",host,"';") FROM mysql.user WHERE host!='localhost';
  
 +
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
  
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
+
=== MariaDB ===
 +
* [http://kb.askmonty.org/en/ MariaDB Knowledge Base]
 +
** [http://kb.askmonty.org/en/using-mysqlbinlog Using mysqlbinlog]
  
 
=== Web interfaces ===
 
=== Web interfaces ===

Revision as of 08:08, 15 July 2012


MySQL

Commands

http://dev.mysql.com/doc/refman/5.6/en/create-user.html
show databases;
show tables;

use [db name];

flush privileges;
grant all on userdatabase.* TO 'username'; [1]

13.7.5.17. SHOW GRANTS Syntax

Create command list for showing user grants [2]

SELECT CONCAT("SHOW GRANTS FOR '",user,"'@'",host,"';") FROM mysql.user WHERE host!='localhost';
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;

MariaDB

Web interfaces

Admin

Tools

https://github.com/tanin47/php_db_migrate

  • http://dbug.ospinto.com/ - "PHP version of ColdFusion’s cfdump. Outputs colored and structured tabular variable information. Variable types supported are: Arrays, Classes/Objects, Database and XML Resources."

Other