Difference between revisions of "Database"

From Things and Stuff Wiki
Jump to navigation Jump to search
Line 95: Line 95:
  
 
* [http://dbug.ospinto.com/ dBug] - "PHP version of ColdFusion’s cfdump. Outputs colored and structured tabular variable information. Variable types supported are: Arrays, Classes/Objects, Database and XML Resources."
 
* [http://dbug.ospinto.com/ dBug] - "PHP version of ColdFusion’s cfdump. Outputs colored and structured tabular variable information. Variable types supported are: Arrays, Classes/Objects, Database and XML Resources."
 +
 +
=== Scripts ===
 +
* http://jetpackweb.com/blog/2009/07/20/bash-script-to-create-mysql-database-and-user/
 +
** [https://gist.github.com/3154546 createdb.sh]
  
 
== Other ==
 
== Other ==

Revision as of 05:29, 21 July 2012


MySQL

Commands

Account management

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
CREATE DATABASE [databasename];

GRANT all on userdatabase.* TO 'username'; [1]

13.7.5.17. SHOW GRANTS

Create command list for showing user grants [2]

SELECT CONCAT("SHOW GRANTS FOR '",user,"'@'",host,"';") FROM mysql.user WHERE host!='localhost';
FLUSH privileges;

DB management

SHOW databases;
SHOW tables;

USE [db name];

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 ;

Security

Troubleshooting

SQLite

MariaDB

Web interfaces

Admin

mysqladmin create db_name

mysqldump

Tools

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

Scripts

Other