Posted By

yuconner on 08/21/06


Tagged

database commands


Versions (?)

Who likes this?

10 people have marked this snippet as a favorite

luman
Phoenix
zingo
jachin
umang_nine
stevewa
kentonnewby
depiction
goliatone
juanchifc


Command line instructions to create a database in MySQL


 / Published in: SQL
 

$ mysql -u ''adminusername'' -p

  1. mysql> CREATE DATABASE ''databasename'';
  2.  
  3. mysql> GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" IDENTIFIED BY "''password''";
  4.  
  5. mysql> FLUSH PRIVILEGES;
  6.  
  7. mysql> EXIT

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: stevewa on July 9, 2010

on Ubunutu 10, this would not work when i removed the 2 single quotes around database name, then it worked.

just replace the databasename with the actual name of the databse you want to create... and replace username with your real username... and replace hostname with the name of your ubuntu server, usually "localhost" will work as the name of the host... and replace password with the ubunutu password for the username you typed before...

so on ubuntu:

mysql> CREATE DATABASE databsename ; mysql> GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'hostname' IDENTIFIED BY 'password' ; mysql> FLUSH PRIVILEGES ; mysql> exit

You need to login to post a comment.