Websitetemplate.org

Welcome > MySQL > MySQL: Create Database

MySQL: Create Database

mysqladmin -uROOTUSER -pROOTPASS create DATABASE
mysql -uROOTUSER -pROOTPASS -e 'grant all on DATABASE.* to USERNAME@localhost identified by "PASSWORD"'

 

Example

$ mysqladmin -uROOT -pPASS create mydatabase
$ mysql
> grant all on mydatabase.* to mylogin@localhost identified by "mypassw0rd";
> USE mydatabase;
> CREATE TABLE table (
    count int(10) unsigned NOT NULL auto_increment,
    contract varchar(5) NOT NULL default '',
    PRIMARY KEY (count),
    KEY contract_idx (contract)
) TYPE=MyISAM;
> flush privileges

Content Copyright 2003-2014 George Toft